﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Assist;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Electrical;
using Autodesk.Revit.DB.Mechanical;
using Autodesk.Revit.DB.Plumbing;
using Autodesk.Revit.Exceptions;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;
using YArchitech.Controls;
using YArchitech.LIB;
using YArchitech.Revit;
using HYView;

namespace HangerSupport
{
	public class HSDraw
	{
		[DllImport("user32.dll", EntryPoint = "SendMessageA")]
		public static extern int SendMessage(IntPtr hwnd, int wMsg, IntPtr wParam, IntPtr lParam);

		public HSDraw(UIApplication uiApp, ref HSTypeInfo HSTypeManage)
		{
			this.m_uiApp = uiApp;
			this.m_HSTypeManage = HSTypeManage;
			this.m_doc = this.m_uiApp.ActiveUIDocument.Document;
			this.m_selection = this.m_uiApp.ActiveUIDocument.Selection;
		}

		public HSDraw(UIApplication uiApp)
		{
			this.m_uiApp = uiApp;
			this.m_HSTypeManage = new HSTypeInfo();
			this.m_doc = this.m_uiApp.ActiveUIDocument.Document;
			this.m_selection = this.m_uiApp.ActiveUIDocument.Selection;
		}

		public static void SetGetParValue(Element ele, string strParName, ref double dValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(strParName);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(dValue);
				}
				else
				{
					dValue = parameter.AsDouble();
				}
			}
		}

		public static void SetGetParValue(Element ele, string strParName, ref int nValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(strParName);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(nValue);
				}
				else
				{
					nValue = parameter.AsInteger();
				}
			}
		}

		public static void SetGetParValue(Element ele, string strParName, ref bool bValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(strParName);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(bValue ? 1 : 0);
				}
				else
				{
					bValue = (parameter.AsInteger() > 0);
				}
			}
		}

		public static void SetGetParValue(Element ele, string strParName, ref string strValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(strParName);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(strValue);
				}
				else
				{
					strValue = parameter.AsString();
				}
			}
		}

		public static void SetGetParValueMM(Element ele, string strParName, ref double dValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(strParName);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(HSFamily.mmToFeet(dValue));
				}
				else
				{
					dValue = HSFamily.feetToMM(parameter.AsDouble());
					dValue = Utils.DoublePrecision(dValue, 1);
				}
			}
		}

		public static void SetGetParValue(Element ele, BuiltInParameter buildInParId, ref string strValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(buildInParId);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(strValue);
				}
				else
				{
					strValue = parameter.AsString();
				}
			}
		}

		public static void SetGetParValueMM(Element ele, BuiltInParameter buildInParId, ref double dValue, bool bSetVal = true)
		{
			Parameter parameter = ele.GetParameter(buildInParId);
			bool flag = parameter != null;
			if (flag)
			{
				if (bSetVal)
				{
					parameter.Set(HSFamily.mmToFeet(dValue));
				}
				else
				{
					dValue = HSFamily.feetToMM(parameter.AsDouble());
					dValue = Utils.DoublePrecision(dValue, 1);
				}
			}
		}

		public double GetHSBottomLevelElevation(ElementId eleId)
		{
			Element element = this.m_doc.GetElement(eleId);
			return this.GetHSBottomLevelElevation(element);
		}

		public double GetHSBottomLevelElevation(Element hsElement)
		{
			double num = 0.0;
			bool flag = hsElement == null;
			double result;
			if (flag)
			{
				result = 0.0;
			}
			else
			{
				Parameter parameter = hsElement.GetParameter(Autodesk.Revit.DB.BuiltInParameter.FAMILY_BASE_LEVEL_PARAM);
				bool flag2 = parameter != null;
				if (flag2)
				{
					Level level = (Level)this.m_doc.GetElement(parameter.AsElementId());
					bool flag3 = level != null;
					if (flag3)
					{
						num = HSFamily.feetToMM(level.Elevation);
					}
				}
				result = num;
			}
			return result;
		}

		public bool SetGetHSFamilyInstanceParValue(Element hsElement, ref HSDefineInfo selHSDefine, bool bSetVal = true)
		{
			bool flag = !bSetVal;
			if (flag)
			{
				FamilySymbol symbol = ((FamilyInstance)hsElement).Symbol;
				bool flag2 = symbol != null;
				if (flag2)
				{
					int eType = (int)selHSDefine.m_eType;
					HSDraw.SetGetParValue(symbol, "HY_HS_INDEX", ref eType, bSetVal);
					HSType eType2 = (HSType)eType;
					selHSDefine = this.m_HSTypeManage.GetItem(eType2);
					HSDraw.SetGetParValue(symbol, "HY_HS_FLOORNUM", ref selHSDefine.m_nFloorNum, bSetVal);
				}
			}
			Parameter parameter = hsElement.GetParameter(Autodesk.Revit.DB.BuiltInParameter.FAMILY_LEVEL_PARAM);
			bool flag3 = parameter != null;
			if (flag3)
			{
				if (bSetVal)
				{
					Level level = this.GetLevel(selHSDefine.m_strElevationName);
					bool flag4 = level != null;
					if (flag4)
					{
						parameter.Set(level.Id);
					}
				}
				else
				{
					Level level2 = (Level)this.m_doc.GetElement(parameter.AsElementId());
					bool flag5 = level2 != null;
					if (flag5)
					{
						selHSDefine.m_strElevationName = level2.Name;
					}
				}
			}
			HSDraw.SetGetParValueMM(hsElement, (BuiltInParameter)(-1001364), ref selHSDefine.m_dElevationOffset, bSetVal);
			bool flag6 = !bSetVal;
			if (flag6)
			{
				selHSDefine.m_dElevationOffset = Utils.DoublePrecision(selHSDefine.m_dElevationOffset, 1);
			}
			HSDraw.SetGetParValueMM(hsElement, "净宽", ref selHSDefine.m_dNetWide, bSetVal);
			HSDraw.SetGetParValue(hsElement, "是否有斜撑", ref selHSDefine.m_bHasBarZJSJ_Lean, bSetVal);
			HSDraw.SetGetParValue(hsElement, "是否有竖杆", ref selHSDefine.m_bHasBarZJSJ_Ver, bSetVal);
			HSDraw.SetGetParValue(hsElement, "Mirrored", ref selHSDefine.m_bMirrored, bSetVal);
			HSDraw.SetGetParValue(hsElement, "是否竖管", ref selHSDefine.m_bIsVerPipe, bSetVal);
			for (int i = 0; i < 20; i++)
			{
				string strParName = "净高" + i.ToString();
				HSDraw.SetGetParValueMM(hsElement, strParName, ref selHSDefine.m_dNetHigh[i], bSetVal);
				bool flag7 = !bSetVal;
				if (flag7)
				{
					selHSDefine.m_dNetHigh[i] = Utils.DoublePrecision(selHSDefine.m_dNetHigh[i], 1);
				}
			}
			HSDraw.SetGetParValueMM(hsElement, "根部高度", ref selHSDefine.m_dDistFromGround, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "高", ref selHSDefine.m_dNetHigh[0], bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "宽", ref selHSDefine.m_dNetWide, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜撑宽", ref selHSDefine.m_dOffsetX, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜撑高", ref selHSDefine.m_dOffsetY, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "管径", ref selHSDefine.m_dLoopDiameter, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "管径偏移量", ref selHSDefine.m_dGapHor, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "管箍厚度", ref selHSDefine.m_dLoopThick, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "管箍长度", ref selHSDefine.m_dLoopLength, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "中杆净宽", ref selHSDefine.m_dOffsetX, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "竖杆增加", ref selHSDefine.m_dOffsetY, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "横担增加", ref selHSDefine.m_dOffsetX, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "偏心净高", ref selHSDefine.m_dPXHigh, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "偏心净宽", ref selHSDefine.m_dPXWide, bSetVal);
			bool flag8 = !bSetVal;
			if (flag8)
			{
				selHSDefine.m_dNetHigh[0] = Utils.DoublePrecision(selHSDefine.m_dNetHigh[0], 1);
				selHSDefine.m_dNetWide = Utils.DoublePrecision(selHSDefine.m_dNetWide, 1);
				selHSDefine.m_dOffsetX = Utils.DoublePrecision(selHSDefine.m_dOffsetX, 1);
				selHSDefine.m_dOffsetY = Utils.DoublePrecision(selHSDefine.m_dOffsetY, 1);
				selHSDefine.m_dPXHigh = Utils.DoublePrecision(selHSDefine.m_dPXHigh, 1);
				selHSDefine.m_dPXWide = Utils.DoublePrecision(selHSDefine.m_dPXWide, 1);
				selHSDefine.m_dLoopDiameter = Utils.DoublePrecision(selHSDefine.m_dLoopDiameter, 1);
			}
			HSDraw.SetGetParValueMM(hsElement, "固件高h", ref selHSDefine.m_dLinkHigh, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "固件宽b", ref selHSDefine.m_dLinkWide, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "固件厚t", ref selHSDefine.m_dLinkThick, bSetVal);
			int eLinkDevice = (int)selHSDefine.m_eLinkDevice1;
			int eLinkDevice2 = (int)selHSDefine.m_eLinkDevice2;
			int eLinkDevice3 = (int)selHSDefine.m_eLinkDevice3;
			HSDraw.SetGetParValue(hsElement, "连接件1", ref eLinkDevice, bSetVal);
			HSDraw.SetGetParValue(hsElement, "连接件2", ref eLinkDevice2, bSetVal);
			HSDraw.SetGetParValue(hsElement, "连接件3", ref eLinkDevice3, bSetVal);
			bool flag9 = !bSetVal;
			if (flag9)
			{
				selHSDefine.m_eLinkDevice1 = (HSLinkDevice)eLinkDevice;
				selHSDefine.m_eLinkDevice2 = (HSLinkDevice)eLinkDevice2;
				selHSDefine.m_eLinkDevice3 = (HSLinkDevice)eLinkDevice3;
			}
			bool flag10 = selHSDefine.m_eType == HSType.kDJ_DZ || selHSDefine.m_eType == HSType.kZJ_DZ;
			if (flag10)
			{
				for (int j = 2; j < 20; j++)
				{
					int num = (int)selHSDefine.m_eLinkDeviceDZ[j - 2];
					string strParName2 = "连接件" + j.ToString();
					HSDraw.SetGetParValue(hsElement, strParName2, ref num, bSetVal);
					bool flag11 = !bSetVal;
					if (flag11)
					{
						selHSDefine.m_eLinkDeviceDZ[j - 2] = (HSLinkDevice)num;
					}
				}
			}
			HSDraw.SetGetParValueMM(hsElement, "竖杆宽b", ref selHSDefine.m_matVer.m_dWide, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "竖杆高h", ref selHSDefine.m_matVer.m_dHigh, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "竖杆厚t", ref selHSDefine.m_matVer.m_dThick, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "竖杆中m", ref selHSDefine.m_matVer.m_dThickMid, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "横担宽b", ref selHSDefine.m_matHor.m_dWide, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "横担高h", ref selHSDefine.m_matHor.m_dHigh, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "横担厚t", ref selHSDefine.m_matHor.m_dThick, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "横担中m", ref selHSDefine.m_matHor.m_dThickMid, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜杆宽b", ref selHSDefine.m_matLean.m_dWide, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜杆高h", ref selHSDefine.m_matLean.m_dHigh, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜杆厚t", ref selHSDefine.m_matLean.m_dThick, bSetVal);
			HSDraw.SetGetParValueMM(hsElement, "斜杆中m", ref selHSDefine.m_matLean.m_dThickMid, bSetVal);
			bool flag12 = !bSetVal;
			if (flag12)
			{
				string text = ((FamilyInstance)hsElement).Symbol.Family.Name;
				int length = text.Length;
				bool flag13 = length > 12;
				if (flag13)
				{
					string text2 = text.Substring(10, 2);
					text = text.Remove(0, text.IndexOf('_') + 1);
					text = text.Remove(0, text.IndexOf('_') + 1);
					text = text.Remove(0, 2);
					selHSDefine.SetSectionType(text);
					selHSDefine.m_eLinkType = HSDraw.GetHSLinkType(hsElement);
				}
			}
			selHSDefine.m_dElevation = Utils.DoublePrecision(selHSDefine.m_dElevation, 1);
			return true;
		}

		public static HSLinkType GetHSLinkType(Element hsElement)
		{
			string text = ((FamilyInstance)hsElement).Symbol.Family.Name;
			text = text.Remove(0, text.IndexOf('_') + 1);
			text = text.Remove(0, text.IndexOf('_') + 1);
			string a = text.Substring(0, 2);
			bool flag = a == "DH";
			HSLinkType result;
			if (flag)
			{
				result = HSLinkType.kLinkDH;
			}
			else
			{
				bool flag2 = a == "BH";
				if (flag2)
				{
					result = HSLinkType.kLinkBH;
				}
				else
				{
					result = HSLinkType.kLinkCG;
				}
			}
			return result;
		}

		private bool isSpecailCableTray(Element secSelectInfo, HSDefineInfo hsDefine)
		{
			bool flag = secSelectInfo == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = (hsDefine.m_eType == HSType.kDJ_DC && hsDefine.m_nFloorNum == 1) || hsDefine.m_eType == HSType.kDJ_GJ;
				if (flag2)
				{
					bool flag3 = secSelectInfo != null && secSelectInfo is CableTray;
					result = flag3;
				}
				else
				{
					result = false;
				}
			}
			return result;
		}

		private bool isSpecailDuct(Element secSelectInfo, HSDefineInfo hsDefine)
		{
			bool flag = secSelectInfo == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = hsDefine.m_eType == HSType.kZJ_XB || hsDefine.m_eType == HSType.kDJ_GJ || hsDefine.m_eType == HSType.kZJ_SJ;
				if (flag2)
				{
					bool flag3 = secSelectInfo != null && secSelectInfo is Duct;
					result = flag3;
				}
				else
				{
					result = false;
				}
			}
			return result;
		}

		private void setDuctParameter(ref HSDefineInfo selHSDefine, Duct duct)
		{
			bool isMaterial = !string.IsNullOrEmpty(duct.GetParameter(Autodesk.Revit.DB.BuiltInParameter.RBS_REFERENCE_INSULATION_TYPE).AsString());
			double thickness = this.getThickness(Math.Round(NumbericTools.feetTomm((duct.Width > duct.Height) ? duct.Width : duct.Height), 0));
			double a = Math.Round(NumbericTools.feetTomm(duct.Width), 0);
			double b = Math.Round(NumbericTools.feetTomm(duct.Height), 0);
			this.setMat(ref selHSDefine, thickness, a, b, isMaterial, selHSDefine.m_eType, 0);
			bool flag = selHSDefine.m_eType == HSType.kDJ_GJ;
			if (flag)
			{
				this.setMatVer(ref selHSDefine, a, isMaterial);
			}
			bool flag2 = selHSDefine.m_eType == HSType.kZJ_SJ;
			if (flag2)
			{
				this.setMat(ref selHSDefine, thickness, a, b, isMaterial, selHSDefine.m_eType, 1);
				this.setMat(ref selHSDefine, thickness, a, b, isMaterial, selHSDefine.m_eType, 2);
			}
		}

		private void setMatVer(ref HSDefineInfo selHSDefine, double a, bool isMaterial)
		{
			bool flag = 0.0 < a && a <= 1250.0;
			if (flag)
			{
				selHSDefine.m_matVer.m_dWide = 10.0;
				selHSDefine.m_matVer.m_dHigh = 10.0;
				selHSDefine.m_matVer.m_dThick = 2.0;
			}
			else if (isMaterial)
			{
				selHSDefine.m_matVer.m_dWide = 12.0;
				selHSDefine.m_matVer.m_dHigh = 12.0;
				selHSDefine.m_matVer.m_dThick = 2.0;
			}
			else
			{
				selHSDefine.m_matVer.m_dWide = 10.0;
				selHSDefine.m_matVer.m_dHigh = 10.0;
				selHSDefine.m_matVer.m_dThick = 2.0;
			}
			selHSDefine.m_matVer.m_strCode = "A";
			selHSDefine.m_matVer.m_strName = "圆钢";
		}

		private void setMat(ref HSDefineInfo selHSDefine, double thickness, double a, double b, bool isMaterial, HSType type, int poleType)
		{
			List<DuctHSInfo> list = null;
			bool flag = type == HSType.kDJ_GJ;
			if (flag)
			{
				list = this.GJList;
			}
			else
			{
				bool flag2 = type == HSType.kZJ_SJ;
				if (flag2)
				{
					list = this.SJList;
				}
				else
				{
					bool flag3 = type == HSType.kZJ_XB;
					if (flag3)
					{
						list = this.XBList;
					}
				}
			}
			bool flag4 = list == null;
			if (!flag4)
			{
				DuctHSInfo ductinfo = (from s in list
				where s.aMax >= a && s.aMin < a && s.thinckness == thickness && b > s.bMin && b <= s.bMax && isMaterial == s.isMaterial
				select s).FirstOrDefault<DuctHSInfo>();
				bool flag5 = poleType == 0;
				if (flag5)
				{
					this.setHSMatInfo(ref selHSDefine.m_matHor, ductinfo);
				}
				else
				{
					bool flag6 = poleType == 1;
					if (flag6)
					{
						this.setHSMatInfo(ref selHSDefine.m_matVer, ductinfo);
					}
					else
					{
						bool flag7 = poleType == 2;
						if (flag7)
						{
							this.setHSMatInfo(ref selHSDefine.m_matLean, ductinfo);
						}
					}
				}
			}
		}

		private void setHSMatInfo(ref HSMatInfo info, DuctHSInfo ductinfo)
		{
			bool flag = ductinfo != null;
			if (flag)
			{
				string format = ductinfo.format;
				bool flag2 = format.Contains("C");
				if (flag2)
				{
					DuctFormatInfo ductFormatInfo = (from s in this.FormatList
					where s.name == format
					select s).FirstOrDefault<DuctFormatInfo>();
					bool flag3 = ductFormatInfo != null;
					if (flag3)
					{
						info.m_dWide = ductFormatInfo.b;
						info.m_dHigh = ductFormatInfo.h;
						info.m_dThick = ductFormatInfo.t;
						info.m_strCode = "C";
						info.m_strName = "槽钢";
					}
				}
				else
				{
					format = format.Replace("L", "");
					string[] array = format.Split(new char[]
					{
						'X'
					});
					bool flag4 = array.Count<string>() == 2;
					if (flag4)
					{
						string value = array[0];
						string value2 = array[0];
						string value3 = array[1];
						info.m_dWide = Convert.ToDouble(value);
						info.m_dHigh = Convert.ToDouble(value2);
						info.m_dThick = Convert.ToDouble(value3);
						info.m_strCode = "B";
						info.m_strName = "角钢";
					}
				}
			}
		}

		private double getThickness(double width)
		{
			bool flag = width <= 320.0;
			double result;
			if (flag)
			{
				result = 0.5;
			}
			else
			{
				bool flag2 = width <= 630.0 && width > 320.0;
				if (flag2)
				{
					result = 0.6;
				}
				else
				{
					bool flag3 = width <= 1000.0 && width > 630.0;
					if (flag3)
					{
						result = 0.75;
					}
					else
					{
						bool flag4 = width <= 1250.0 && width > 1000.0;
						if (flag4)
						{
							result = 1.0;
						}
						else
						{
							bool flag5 = width <= 2000.0 && width > 1250.0;
							if (flag5)
							{
								result = 1.0;
							}
							else
							{
								bool flag6 = width <= 4000.0 && width > 2000.0;
								if (flag6)
								{
									result = 1.2;
								}
								else
								{
									result = 1.2;
								}
							}
						}
					}
				}
			}
			return result;
		}

		private void setCableTrayParameter(ref HSDefineInfo selHSDefine, bool isDc)
		{
			if (isDc)
			{
				selHSDefine.m_matVer.m_dWide = 40.0;
				selHSDefine.m_matVer.m_dHigh = 40.0;
				selHSDefine.m_matVer.m_dThick = 4.0;
				selHSDefine.m_matVer.m_strCode = "B";
				selHSDefine.m_matVer.m_strName = "角钢";
				selHSDefine.m_matHor.m_dWide = 50.0;
				selHSDefine.m_matHor.m_dHigh = 50.0;
				selHSDefine.m_matHor.m_dThick = 5.0;
				selHSDefine.m_matHor.m_strCode = "B";
				selHSDefine.m_matHor.m_strName = "角钢";
			}
			else
			{
				bool flag = selHSDefine.m_dNetWide - selHSDefine.m_dGapVer * 2.0 > 200.0;
				if (flag)
				{
					selHSDefine.m_matVer.m_dWide = 12.0;
					selHSDefine.m_matVer.m_dHigh = 12.0;
					selHSDefine.m_matVer.m_dThick = 2.0;
					selHSDefine.m_matVer.m_strCode = "A";
					selHSDefine.m_matVer.m_strName = "圆钢";
				}
				else
				{
					selHSDefine.m_matVer.m_dWide = 10.0;
					selHSDefine.m_matVer.m_dHigh = 10.0;
					selHSDefine.m_matVer.m_dThick = 2.0;
					selHSDefine.m_matVer.m_strCode = "A";
					selHSDefine.m_matVer.m_strName = "圆钢";
				}
				selHSDefine.m_matHor.m_dWide = 40.0;
				selHSDefine.m_matHor.m_dHigh = 40.0;
				selHSDefine.m_matHor.m_dThick = 4.0;
				selHSDefine.m_matHor.m_strCode = "B";
				selHSDefine.m_matHor.m_strName = "角钢";
			}
		}

		private bool IsSpecailPipe(Element secSelectInfo, HSDefineInfo hsDefine)
		{
			bool flag = secSelectInfo == null;
			return !flag && secSelectInfo is Pipe;
		}

		private void SetPipeParameterAndGetLayDis(ref HSDefineInfo selHSDefine, ref double layDis, Pipe pipe)
		{
			bool flag = selHSDefine.m_strName == "悬臂支架" || selHSDefine.m_strName == "三角支架";
			if (flag)
			{
				selHSDefine.m_matVer.m_strCode = "B";
				selHSDefine.m_matVer.m_strName = "角钢";
				selHSDefine.m_matHor.m_strCode = "B";
				selHSDefine.m_matHor.m_strName = "角钢";
				selHSDefine.m_matLean.m_strCode = "B";
				selHSDefine.m_matLean.m_strName = "角钢";
			}
			else
			{
				selHSDefine.m_matVer.m_strCode = "A";
				selHSDefine.m_matVer.m_strName = "圆钢";
				selHSDefine.m_matHor.m_strCode = "B";
				selHSDefine.m_matHor.m_strName = "角钢";
				selHSDefine.m_matLean.m_strCode = "A";
				selHSDefine.m_matLean.m_strName = "圆钢";
			}
			bool isInsulatedPipe = false;
			double diameter = 0.0;
			this.GetPipeParams(pipe, ref isInsulatedPipe, ref diameter);
			HSType eType = selHSDefine.m_eType;
			if (eType <= HSType.kZJ_XB)
			{
				if (eType == HSType.kZJ_SJ)
				{
					this.SetPipe_kZJ_SJ(ref selHSDefine, isInsulatedPipe, diameter);
					this.GetPipeDis_kZJ_SJ(isInsulatedPipe, diameter, ref layDis);
					return;
				}
				if (eType == HSType.kZJ_XB)
				{
					this.SetPipe_kZJ_XB(ref selHSDefine, isInsulatedPipe, diameter);
					this.GetPipeDis_kZJ_XB(isInsulatedPipe, diameter, ref layDis);
					return;
				}
			}
			else
			{
				if (eType == HSType.kDJ_GJ)
				{
					this.SetPipe_kDJ_GJ(ref selHSDefine, isInsulatedPipe, diameter);
					this.GetPipeDis_kDJ_GJ(isInsulatedPipe, diameter, ref layDis);
					return;
				}
				if (eType == HSType.kDJ_DG)
				{
					this.SetPipe_kDJ_DG(ref selHSDefine, isInsulatedPipe, diameter);
					this.GetPipeDis_kDJ_DG(isInsulatedPipe, diameter, ref layDis);
					return;
				}
			}
			this.GetPipeDis_Other(ref layDis);
		}

		private void SetPipe_kZJ_XB(ref HSDefineInfo selHSDefine, bool isInsulatedPipe, double diameter)
		{
			if (isInsulatedPipe)
			{
				bool flag = diameter <= 101.0 && diameter >= 15.0;
				if (flag)
				{
					selHSDefine.m_matHor.b宽 = 45.0;
					selHSDefine.m_matHor.h高 = 45.0;
					selHSDefine.m_matHor.t厚 = 4.0;
				}
				else
				{
					bool flag2 = diameter <= 126.0 && diameter > 101.0;
					if (flag2)
					{
						selHSDefine.m_matHor.b宽 = 50.0;
						selHSDefine.m_matHor.h高 = 50.0;
						selHSDefine.m_matHor.t厚 = 5.0;
					}
					else
					{
						bool flag3 = diameter > 126.0;
						if (flag3)
						{
							selHSDefine.m_matHor.b宽 = 75.0;
							selHSDefine.m_matHor.h高 = 75.0;
							selHSDefine.m_matHor.t厚 = 7.0;
						}
					}
				}
			}
			else
			{
				bool flag4 = diameter <= 101.0;
				if (flag4)
				{
					selHSDefine.m_matHor.b宽 = 45.0;
					selHSDefine.m_matHor.h高 = 45.0;
					selHSDefine.m_matHor.t厚 = 4.0;
				}
				else
				{
					bool flag5 = diameter > 101.0 && diameter <= 126.0;
					if (flag5)
					{
						selHSDefine.m_matHor.b宽 = 50.0;
						selHSDefine.m_matHor.h高 = 50.0;
						selHSDefine.m_matHor.t厚 = 5.0;
					}
					else
					{
						bool flag6 = diameter > 126.0 && diameter <= 151.0;
						if (flag6)
						{
							selHSDefine.m_matHor.b宽 = 63.0;
							selHSDefine.m_matHor.h高 = 63.0;
							selHSDefine.m_matHor.t厚 = 6.0;
						}
						else
						{
							bool flag7 = diameter > 151.0;
							if (flag7)
							{
								selHSDefine.m_matHor.b宽 = 75.0;
								selHSDefine.m_matHor.h高 = 75.0;
								selHSDefine.m_matHor.t厚 = 7.0;
							}
						}
					}
				}
			}
		}

		private void SetPipe_kZJ_SJ(ref HSDefineInfo selHSDefine, bool isInsulatedPipe, double diameter)
		{
			if (isInsulatedPipe)
			{
				bool flag = diameter <= 201.0;
				if (flag)
				{
					selHSDefine.m_matHor.b宽 = 50.0;
					selHSDefine.m_matHor.h高 = 50.0;
					selHSDefine.m_matHor.t厚 = 5.0;
					selHSDefine.m_matVer.b宽 = 50.0;
					selHSDefine.m_matVer.h高 = 50.0;
					selHSDefine.m_matVer.t厚 = 5.0;
					selHSDefine.m_matLean.b宽 = 50.0;
					selHSDefine.m_matLean.h高 = 50.0;
					selHSDefine.m_matLean.t厚 = 5.0;
				}
				else
				{
					bool flag2 = diameter > 201.0 && diameter <= 301.0;
					if (flag2)
					{
						selHSDefine.m_matHor.b宽 = 63.0;
						selHSDefine.m_matHor.h高 = 63.0;
						selHSDefine.m_matHor.t厚 = 6.0;
						selHSDefine.m_matVer.b宽 = 63.0;
						selHSDefine.m_matVer.h高 = 63.0;
						selHSDefine.m_matVer.t厚 = 6.0;
						selHSDefine.m_matLean.b宽 = 63.0;
						selHSDefine.m_matLean.h高 = 63.0;
						selHSDefine.m_matLean.t厚 = 6.0;
					}
					else
					{
						bool flag3 = diameter > 301.0;
						if (flag3)
						{
							selHSDefine.m_matHor.b宽 = 75.0;
							selHSDefine.m_matHor.h高 = 75.0;
							selHSDefine.m_matHor.t厚 = 7.0;
							selHSDefine.m_matVer.b宽 = 75.0;
							selHSDefine.m_matVer.h高 = 75.0;
							selHSDefine.m_matVer.t厚 = 7.0;
							selHSDefine.m_matLean.b宽 = 75.0;
							selHSDefine.m_matLean.h高 = 75.0;
							selHSDefine.m_matLean.t厚 = 7.0;
						}
					}
				}
			}
			else
			{
				bool flag4 = diameter <= 201.0;
				if (flag4)
				{
					selHSDefine.m_matHor.b宽 = 50.0;
					selHSDefine.m_matHor.h高 = 50.0;
					selHSDefine.m_matHor.t厚 = 5.0;
					selHSDefine.m_matVer.b宽 = 50.0;
					selHSDefine.m_matVer.h高 = 50.0;
					selHSDefine.m_matVer.t厚 = 5.0;
					selHSDefine.m_matLean.b宽 = 50.0;
					selHSDefine.m_matLean.h高 = 50.0;
					selHSDefine.m_matLean.t厚 = 5.0;
				}
				else
				{
					bool flag5 = diameter > 201.0 && diameter <= 301.0;
					if (flag5)
					{
						selHSDefine.m_matHor.b宽 = 63.0;
						selHSDefine.m_matHor.h高 = 63.0;
						selHSDefine.m_matHor.t厚 = 6.0;
						selHSDefine.m_matVer.b宽 = 63.0;
						selHSDefine.m_matVer.h高 = 63.0;
						selHSDefine.m_matVer.t厚 = 6.0;
						selHSDefine.m_matLean.b宽 = 63.0;
						selHSDefine.m_matLean.h高 = 63.0;
						selHSDefine.m_matLean.t厚 = 6.0;
					}
					else
					{
						bool flag6 = diameter > 301.0 && diameter <= 351.0;
						if (flag6)
						{
							selHSDefine.m_matHor.b宽 = 63.0;
							selHSDefine.m_matHor.h高 = 63.0;
							selHSDefine.m_matHor.t厚 = 6.0;
							selHSDefine.m_matVer.b宽 = 63.0;
							selHSDefine.m_matVer.h高 = 63.0;
							selHSDefine.m_matVer.t厚 = 6.0;
							selHSDefine.m_matLean.b宽 = 63.0;
							selHSDefine.m_matLean.h高 = 63.0;
							selHSDefine.m_matLean.t厚 = 6.0;
						}
						else
						{
							bool flag7 = diameter > 351.0;
							if (flag7)
							{
								selHSDefine.m_matHor.b宽 = 75.0;
								selHSDefine.m_matHor.h高 = 75.0;
								selHSDefine.m_matHor.t厚 = 7.0;
								selHSDefine.m_matVer.b宽 = 75.0;
								selHSDefine.m_matVer.h高 = 75.0;
								selHSDefine.m_matVer.t厚 = 7.0;
								selHSDefine.m_matLean.b宽 = 75.0;
								selHSDefine.m_matLean.h高 = 75.0;
								selHSDefine.m_matLean.t厚 = 7.0;
							}
						}
					}
				}
			}
		}

		private void SetPipe_kDJ_GJ(ref HSDefineInfo selHSDefine, bool isInsulatedPipe, double diameter)
		{
			if (isInsulatedPipe)
			{
				bool flag = diameter <= 201.0;
				if (flag)
				{
					selHSDefine.m_matHor.b宽 = 50.0;
					selHSDefine.m_matHor.h高 = 50.0;
					selHSDefine.m_matHor.t厚 = 5.0;
					selHSDefine.m_matVer.b宽 = 10.0;
					selHSDefine.m_matVer.h高 = 10.0;
					selHSDefine.m_matVer.t厚 = 5.0;
				}
				else
				{
					bool flag2 = diameter > 201.0 && diameter <= 251.0;
					if (flag2)
					{
						selHSDefine.m_matHor.b宽 = 63.0;
						selHSDefine.m_matHor.h高 = 63.0;
						selHSDefine.m_matHor.t厚 = 6.0;
						selHSDefine.m_matVer.b宽 = 10.0;
						selHSDefine.m_matVer.h高 = 10.0;
						selHSDefine.m_matVer.t厚 = 5.0;
					}
					else
					{
						bool flag3 = diameter > 251.0;
						if (flag3)
						{
							selHSDefine.m_matHor.b宽 = 75.0;
							selHSDefine.m_matHor.h高 = 75.0;
							selHSDefine.m_matHor.t厚 = 7.0;
							selHSDefine.m_matVer.b宽 = 10.0;
							selHSDefine.m_matVer.h高 = 10.0;
							selHSDefine.m_matVer.t厚 = 5.0;
						}
					}
				}
			}
			else
			{
				bool flag4 = diameter <= 201.0;
				if (flag4)
				{
					selHSDefine.m_matHor.b宽 = 50.0;
					selHSDefine.m_matHor.h高 = 50.0;
					selHSDefine.m_matHor.t厚 = 5.0;
					selHSDefine.m_matVer.b宽 = 10.0;
					selHSDefine.m_matVer.h高 = 10.0;
					selHSDefine.m_matVer.t厚 = 5.0;
				}
				else
				{
					bool flag5 = diameter > 201.0;
					if (flag5)
					{
						selHSDefine.m_matHor.b宽 = 63.0;
						selHSDefine.m_matHor.h高 = 63.0;
						selHSDefine.m_matHor.t厚 = 6.0;
						selHSDefine.m_matVer.b宽 = 10.0;
						selHSDefine.m_matVer.h高 = 10.0;
						selHSDefine.m_matVer.t厚 = 5.0;
					}
				}
			}
		}

		private void SetPipe_kDJ_DG(ref HSDefineInfo selHSDefine, bool isInsulatedPipe, double diameter)
		{
			bool flag = diameter <= 51.0 && diameter >= 15.0;
			if (flag)
			{
				selHSDefine.m_matVer.b宽 = 10.0;
				selHSDefine.m_matVer.h高 = 10.0;
				selHSDefine.m_matVer.t厚 = 5.0;
			}
			else
			{
				bool flag2 = diameter > 51.0 && diameter <= 101.0;
				if (flag2)
				{
					selHSDefine.m_matVer.b宽 = 12.0;
					selHSDefine.m_matVer.h高 = 12.0;
					selHSDefine.m_matVer.t厚 = 5.0;
				}
				else
				{
					bool flag3 = diameter > 101.0 && diameter <= 201.0;
					if (flag3)
					{
						selHSDefine.m_matVer.b宽 = 16.0;
						selHSDefine.m_matVer.h高 = 16.0;
						selHSDefine.m_matVer.t厚 = 5.0;
					}
					else
					{
						bool flag4 = diameter > 201.0;
						if (flag4)
						{
							selHSDefine.m_matVer.b宽 = 20.0;
							selHSDefine.m_matVer.h高 = 20.0;
							selHSDefine.m_matVer.t厚 = 5.0;
						}
					}
				}
			}
		}

		private void GetPipeDis_kZJ_XB(bool isInsulatedPipe, double diameter, ref double layDis)
		{
			if (isInsulatedPipe)
			{
				bool flag = diameter >= 15.0 && diameter <= 33.0;
				if (flag)
				{
					layDis = 1500.0;
				}
				else
				{
					bool flag2 = diameter > 33.0 && diameter <= 126.0;
					if (flag2)
					{
						layDis = 3000.0;
					}
					else
					{
						bool flag3 = diameter > 126.0;
						if (flag3)
						{
							layDis = 6000.0;
						}
						else
						{
							layDis = 1500.0;
						}
					}
				}
			}
			else
			{
				bool flag4 = diameter >= 15.0 && diameter <= 33.0;
				if (flag4)
				{
					layDis = 1500.0;
				}
				else
				{
					bool flag5 = diameter > 33.0 && diameter <= 51.0;
					if (flag5)
					{
						layDis = 3000.0;
					}
					else
					{
						bool flag6 = diameter > 51.0;
						if (flag6)
						{
							layDis = 6000.0;
						}
						else
						{
							layDis = 1500.0;
						}
					}
				}
			}
		}

		private void GetPipeDis_kZJ_SJ(bool isInsulatedPipe, double diameter, ref double layDis)
		{
			layDis = 3000.0;
		}

		private void GetPipeDis_kDJ_GJ(bool isInsulatedPipe, double diameter, ref double layDis)
		{
			layDis = 3000.0;
		}

		private void GetPipeDis_kDJ_DG(bool isInsulatedPipe, double diameter, ref double layDis)
		{
			bool flag = diameter >= 15.0 && diameter <= 101.0;
			if (flag)
			{
				layDis = 3000.0;
			}
			else
			{
				bool flag2 = diameter > 101.0;
				if (flag2)
				{
					layDis = 6000.0;
				}
				else
				{
					layDis = 3000.0;
				}
			}
		}

		private void GetPipeDis_Other(ref double layDis)
		{
			layDis = 3000.0;
		}

		private void GetPipeParams(Pipe pipe, ref bool isInsulatedPipe, ref double diameter)
		{
			Parameter parameter = pipe.GetParameter(Autodesk.Revit.DB.BuiltInParameter.RBS_REFERENCE_INSULATION_TYPE);
			bool flag = parameter != null && parameter.HasValue;
			if (flag)
			{
				isInsulatedPipe = true;
			}
			else
			{
				isInsulatedPipe = false;
			}
			Parameter parameter2 = pipe.GetParameter(Autodesk.Revit.DB.BuiltInParameter.RBS_PIPE_DIAMETER_PARAM);
			bool flag2 = parameter2 != null && parameter2.HasValue;
			if (flag2)
			{
				diameter = AssistFunc.feetToMM(parameter2.AsDouble());
			}
		}

		public static FilteredElementCollector GetElements(Autodesk.Revit.DB.Document document)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document);
			return filteredElementCollector.WhereElementIsNotElementType();
		}

		public static FilteredElementCollector GetElementsCurLevel(Autodesk.Revit.DB.Document document)
		{
			Autodesk.Revit.DB.View activeView = document.ActiveView;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document, activeView.Id);
			return filteredElementCollector.WhereElementIsNotElementType();
		}

		public static int GetElementCount(Autodesk.Revit.DB.Document document)
		{
			return HSDraw.GetElements(document).ToElements().Count;
		}

		public static List<ElementId> GetElementsIdAfter(int n, Autodesk.Revit.DB.Document document)
		{
			List<ElementId> list = new List<ElementId>();
			FilteredElementCollector elements = HSDraw.GetElements(document);
			int num = 0;
			foreach (Element element in elements)
			{
				num++;
				bool flag = n < num;
				if (flag)
				{
					list.Add(element.Id);
				}
			}
			return list;
		}

		public static Element GetNewAddElement(int n, Autodesk.Revit.DB.Document document)
		{
			FilteredElementCollector elements = HSDraw.GetElements(document);
			int num = elements.ToElements().Count<Element>();
			int num2 = 0;
			foreach (Element element in elements)
			{
				num2++;
				bool flag = n < num2;
				if (flag)
				{
					return document.GetElement(element.Id);
				}
			}
			return null;
		}

		private FamilySymbol GetHSSymbol()
		{
			CmdViewType types = (CmdViewType)17;
			bool flag = SwitchView.SetUsableView(types, this.m_uiApp) > 0;
			FamilySymbol result;
			if (flag)
			{
				result = null;
			}
			else
			{
				HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
				result = this.GetHSSymbol(hsTypeDefault);
			}
			return result;
		}

		private FamilySymbol GetHSSymbol(HSDefineInfo selHSDefine)
		{
			HSFamily hsfamily = new HSFamily(this.m_uiApp);
			bool flag = !hsfamily.CreateHSFamily(selHSDefine, false, true, this.isTran);
			FamilySymbol result;
			if (flag)
			{
				YJKMessageBox.Information("创建支吊架族出错！");
				result = null;
			}
			else
			{
				string familyName = "";
				string symbolName = "";
				selHSDefine.GetHSFamilyName(ref familyName, ref symbolName, this.m_uiApp);
				FamilySymbol familySymbolByName = hsfamily.GetFamilySymbolByName(familyName, symbolName);
				result = familySymbolByName;
			}
			return result;
		}

		public bool DrawSingleFree()
		{
			FamilySymbol hssymbol = this.GetHSSymbol();
			bool flag = hssymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				int elementCount = HSDraw.GetElementCount(this.m_doc);
				try
				{
					this.m_uiApp.ActiveUIDocument.PromptForFamilyInstancePlacement(hssymbol);
				}
				catch (Autodesk.Revit.Exceptions.OperationCanceledException)
				{
					return true;
				}
				catch (Exception ex)
				{
					Utils.MessageBox(ex.Message);
				}
				HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
				List<ElementId> elementsIdAfter = HSDraw.GetElementsIdAfter(elementCount, this.m_doc);
				bool flag2 = elementsIdAfter.Count == 0;
				if (flag2)
				{
					result = true;
				}
				else
				{
					Transaction transaction = new Transaction(this.m_uiApp.ActiveUIDocument.Document, "EditHS");
					try
					{
						transaction.Start();
						List<ElementId> list = new List<ElementId>();
						foreach (ElementId elementId in elementsIdAfter)
						{
							XYZ ptBase = null;
							double dAngle = 0.0;
							Element elementById = this.m_uiApp.ActiveUIDocument.Document.GetElementById(elementId);
							this.GetHSLocation(ref dAngle, ref ptBase, elementById);
							Element element = this.NewHS(ptBase, dAngle, hssymbol, ref hsTypeDefault, null);
							list.Add(element.Id);
							this.m_uiApp.ActiveUIDocument.Document.DeleteElement(elementById);
						}
						this.m_doc.Regenerate();
					}
					catch (Exception ex2)
					{
						string message = ex2.Message;
						return false;
					}
					finally
					{
						bool flag3 = transaction != null;
						if (flag3)
						{
							TransactionStatus status = transaction.GetStatus();
							bool flag4 = (int)status == 1;
							if (flag4)
							{
								transaction.Commit();
							}
							else
							{
								bool flag5 = (int)status == 5;
								if (flag5)
								{
									transaction.RollBack();
								}
							}
						}
					}
					result = true;
				}
			}
			return result;
		}

		public void ChangeHSSize(List<ElementId> lstHSID, HSDefineInfo selHSDefine)
		{
			bool flag = lstHSID.Count > 0;
			if (flag)
			{
				foreach (ElementId elementId in lstHSID)
				{
					Element element = this.m_doc.GetElement(elementId);
					bool flag2 = element == null;
					if (!flag2)
					{
						double dAngle = 0.0;
						XYZ xyz = null;
						this.GetHSLocationIncludeElevation(ref dAngle, ref xyz, element);
						List<XYZ> ptlst = new List<XYZ>();
						double dFromBaseHigh = 0.0;
						this.GetHSVerLinkPts(ref ptlst, ref dFromBaseHigh, selHSDefine, dAngle, xyz);
						HSDefineInfo hsdefineInfo = new HSDefineInfo(selHSDefine);
						bool flag3 = hsdefineInfo.m_eType == HSType.kZJ_DC || hsdefineInfo.m_eType == HSType.kZJ_PX || hsdefineInfo.m_eType == HSType.kZJ_DZ;
						if (flag3)
						{
							hsdefineInfo.m_dDistFromGround -= Utils.feetToMM(xyz.Z);
							bool flag4 = hsdefineInfo.m_dDistFromGround < 0.0;
							if (flag4)
							{
								hsdefineInfo.m_dDistFromGround = 10.0;
							}
						}
						bool flag5 = hsdefineInfo.IsCanLinkBoardBeam();
						if (flag5)
						{
							bool flag6 = !this.GetHSLinkBeamHigh(ref hsdefineInfo, ptlst, dFromBaseHigh);
							if (flag6)
							{
								this.GetHSLinkBoardHigh(ref hsdefineInfo, ptlst, dFromBaseHigh);
							}
						}
						this.SetGetHSFamilyInstanceParValue(element, ref hsdefineInfo, true);
					}
				}
			}
		}

		public bool DrawSingleBySectionPipe(PipeSelect secSelectInfo)
		{
			CmdViewType types = (CmdViewType)17;
			bool flag = SwitchView.SetUsableView(types, this.m_uiApp) > 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				Element element = secSelectInfo.m_listElementSel[0];
				MEPCurve mepcurve = element as MEPCurve;
				bool flag2 = mepcurve == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					LocationCurve locationCurve = mepcurve.Location as LocationCurve;
					XYZ endPoint = locationCurve.Curve.GetEndPoint(0);
					XYZ xyz = endPoint;
					double num = secSelectInfo.m_dAngle;
					bool bMirrored = this.m_HSTypeManage.m_hsTypeDefault.m_bMirrored;
					if (bMirrored)
					{
						num += Math.PI;
					}
					for (;;)
					{
						XYZ xyz2 = null;
						try
						{
							xyz2 = this.m_selection.PickPoint("在提取剖面的管道上选择点确定支吊架位置");
						}
						catch (Exception)
						{
							return false;
						}
						XYZ cloestPointOnCurve = Utils.getCloestPointOnCurve(xyz2, locationCurve.Curve, true);
						double num2 = cloestPointOnCurve.Z - xyz.Z;
						xyz = cloestPointOnCurve;
						bool flag3 = this.m_HSTypeManage.m_hsTypeDefault.IsSupport();
						if (flag3)
						{
							num2 *= -1.0;
						}
						this.m_HSTypeManage.m_hsTypeDefault.ChangeHighValueFromBaseOnly(Utils.feetToMM(-num2));
						XYZ xyz3 = secSelectInfo.GetDrawMidPoint(xyz2);
						xyz3 = Utils.SetPtZ(xyz3, cloestPointOnCurve.Z);
						FamilySymbol hssymbol = this.GetHSSymbol();
						bool flag4 = hssymbol == null;
						if (flag4)
						{
							break;
						}
						XYZ xyz4 = Utils.Vector(num);
						HSType eType = this.m_HSTypeManage.m_hsTypeDefault.m_eType;
						if (eType == HSType.kZJ_PX)
						{
							goto IL_1B2;
						}
						if (eType != HSType.kZJ_CB)
						{
							switch (eType)
							{
							case HSType.kDJ_PX:
							case HSType.kDJ_DB:
							case HSType.kDJ_SG:
							case HSType.kDJ_SL:
							case HSType.kDJ_DC3:
								goto IL_1B2;
							}
						}
						else
						{
							xyz3 -= xyz4 * HSFamily.mmToFeet(this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopThick + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopDiameter / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dGapHor);
							this.m_HSTypeManage.m_hsTypeDefault.m_dElevationOffset = HSFamily.feetToMM(xyz3.Z);
						}
						IL_266:
						Transaction transaction = new Transaction(this.m_doc, "CreateHS");
						transaction.Start();
						FamilyInstance familyInstance = this.NewHS(xyz3, num, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
						transaction.Commit();
						bool flag5 = familyInstance == null;
						if (flag5)
						{
							goto Block_10;
						}
						continue;
						IL_1B2:
						xyz3 -= xyz4 * HSFamily.mmToFeet(this.m_HSTypeManage.m_hsTypeDefault.m_dHangerDBOffsetDist);
						goto IL_266;
					}
					return false;
					Block_10:
					result = false;
				}
			}
			return result;
		}

		public FamilyInstance NewHS(XYZ ptBase, double dAngle)
		{
			FamilySymbol hssymbol = this.GetHSSymbol();
			bool flag = hssymbol == null;
			FamilyInstance result;
			if (flag)
			{
				result = null;
			}
			else
			{
				HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
				result = this.NewHS(ptBase, dAngle, hssymbol, ref hsTypeDefault, null);
			}
			return result;
		}

		public FamilyInstance NewHS(XYZ ptBase, double dAngle, Element eleCopyFrom)
		{
			LocationPoint locationPoint = eleCopyFrom.Location as LocationPoint;
			XYZ xyz = ptBase - locationPoint.Point;
			xyz = Utils.PtTo2d(xyz);
			ICollection<ElementId> source = ElementTransformUtils.CopyElement(this.m_doc, eleCopyFrom.Id, xyz);
			FamilyInstance familyInstance = (FamilyInstance)this.m_doc.GetElement(source.ElementAt(0));
			Line line = Line.CreateBound(ptBase, ptBase + XYZ.BasisZ);
			ElementTransformUtils.RotateElement(this.m_doc, familyInstance.Id, line, dAngle - locationPoint.Rotation);
			HSDefineInfo elementHSDefine = this.GetElementHSDefine(familyInstance);
			List<XYZ> ptlst = new List<XYZ>();
			double dFromBaseHigh = 0.0;
			this.GetHSVerLinkPts(ref ptlst, ref dFromBaseHigh, elementHSDefine, dAngle, ptBase);
			bool flag = elementHSDefine.IsCanLinkBoardBeam();
			if (flag)
			{
				bool flag2 = !this.GetHSLinkBeamHigh(ref elementHSDefine, ptlst, dFromBaseHigh);
				if (flag2)
				{
					this.GetHSLinkBoardHigh(ref elementHSDefine, ptlst, dFromBaseHigh);
				}
			}
			this.SetGetHSFamilyInstanceParValue(familyInstance, ref elementHSDefine, true);
			return familyInstance;
		}

		public FamilyInstance NewHS(XYZ ptBase, double dAngle, FamilySymbol hsType, ref HSDefineInfo selHSDefine, Level curDownLevel = null)
		{
			bool flag = hsType == null;
			FamilyInstance result;
			if (flag)
			{
				result = null;
			}
			else
			{
				bool flag2 = curDownLevel == null;
				if (flag2)
				{
					curDownLevel = this.GetLevel(selHSDefine.m_strElevationName);
				}
				bool flag3 = curDownLevel == null;
				if (flag3)
				{
					curDownLevel = this.m_doc.ActiveView.GenLevel;
				}
				bool flag4 = curDownLevel == null;
				if (flag4)
				{
					curDownLevel = this.GetUpLevel(null);
				}
				UnifiedModified.ActivateFamilySymbol(hsType);
				FamilyInstance familyInstance = this.m_doc.Create.NewFamilyInstance(ptBase, hsType, curDownLevel, (Autodesk.Revit.DB.Structure.StructuralType)0);
				Line line = Line.CreateBound(ptBase, ptBase + XYZ.BasisZ);
				ElementTransformUtils.RotateElement(this.m_doc, familyInstance.Id, line, dAngle);
				List<XYZ> ptlst = new List<XYZ>();
				double dFromBaseHigh = 0.0;
				this.GetHSVerLinkPts(ref ptlst, ref dFromBaseHigh, selHSDefine, dAngle, ptBase);
				HSDefineInfo hsdefineInfo = new HSDefineInfo(selHSDefine);
				bool flag5 = hsdefineInfo.IsCanLinkBoardBeam();
				if (flag5)
				{
					bool flag6 = !this.GetHSLinkBeamHigh(ref hsdefineInfo, ptlst, dFromBaseHigh);
					if (flag6)
					{
						this.GetHSLinkBoardHigh(ref hsdefineInfo, ptlst, dFromBaseHigh);
					}
				}
				this.SetGetHSFamilyInstanceParValue(familyInstance, ref hsdefineInfo, true);
				result = familyInstance;
			}
			return result;
		}

		private List<RevitLinkInstance> GetAllRevitLinkInstancesInDoc()
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc).OfClass(typeof(RevitLinkInstance));
			ICollection<ElementId> collection = filteredElementCollector.ToElementIds();
			List<RevitLinkInstance> list = new List<RevitLinkInstance>();
			foreach (ElementId elementId in collection)
			{
				Element element = this.m_doc.GetElement(elementId);
				bool flag = element.GetType() != typeof(RevitLinkInstance);
				if (!flag)
				{
					RevitLinkInstance revitLinkInstance = element as RevitLinkInstance;
					bool flag2 = revitLinkInstance != null;
					if (flag2)
					{
						list.Add(revitLinkInstance);
					}
				}
			}
			return list;
		}

		public bool GetHSLinkBoardHigh(ref HSDefineInfo selHSDefine, List<XYZ> ptlst, double dFromBaseHigh)
		{
			bool flag = ptlst.Count == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				Document doc = this.m_doc;
				Options options = new Options();
				FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
				ICollection<Element> collection = filteredElementCollector.OfClass(typeof(Floor)).ToElements();
				bool flag2 = collection.Count == 0;
				if (flag2)
				{
					List<RevitLinkInstance> allRevitLinkInstancesInDoc = this.GetAllRevitLinkInstancesInDoc();
					IList<Document> list = (from link in allRevitLinkInstancesInDoc
					select link.GetLinkDocument()).ToList<Document>();
					foreach (Autodesk.Revit.DB.Document document in list)
					{
						bool flag3 = document == null;
						if (!flag3)
						{
							filteredElementCollector = new FilteredElementCollector(document);
							collection = filteredElementCollector.OfClass(typeof(Floor)).ToElements();
							bool flag4 = collection.Count == 0;
							if (!flag4)
							{
								break;
							}
						}
					}
					bool flag5 = collection.Count == 0;
					if (flag5)
					{
						return false;
					}
				}
				bool flag6 = selHSDefine.IsSupport();
				double num = 0.0;
				try
				{
					Level level = Utils.GetLevel(selHSDefine.m_strElevationName, this.m_doc);
					num = level.Elevation;
				}
				catch (Exception ex)
				{
					return false;
				}
				double num2 = HSFamily.mmToFeet(dFromBaseHigh);
				double num3 = num + ptlst[0].Z;
				bool flag7 = flag6;
				if (flag7)
				{
					num3 += num2;
				}
				else
				{
					num3 -= num2;
				}
				double num4 = 0.0;
				foreach (Element element in collection)
				{
					XYZ xyz = null;
					Floor elem = element as Floor;
					Level hylevel = elem.GetYJKLevel();
					double elevation = hylevel.Elevation;
					Parameter parameter = element.GetParameter(Autodesk.Revit.DB.BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM);
					double num5 = parameter.AsDouble();
					double num6 = elevation + num5;
					double num7 = 0.0;
					double mmVal = 0.0;
					double num8 = Utils.GetBoardStructureThick(element, ref num7, ref mmVal);
					num7 = HSFamily.mmToFeet(num7);
					mmVal = HSFamily.mmToFeet(mmVal);
					num8 = HSFamily.mmToFeet(num8);
					double num9 = HSFamily.mmToFeet(selHSDefine.m_dLinkThick);
					bool flag8 = selHSDefine.m_eLinkDevice1 == HSLinkDevice.kLinkDeviceNone;
					if (flag8)
					{
						num9 = 0.0;
					}
					GeometryElement geometryElement = element.get_Geometry(options);
					foreach (GeometryObject geometryObject in geometryElement)
					{
						Solid solid = geometryObject as Solid;
						bool flag9 = null != solid;
						if (flag9)
						{
							double num10 = -1.0;
							XYZ xyz2 = null;
							foreach (object obj in solid.Faces)
							{
								Face face = (Face)obj;
								double area = face.Area;
								bool flag10 = num10 < 0.0;
								Face face2;
								if (flag10)
								{
									num10 = area;
									face2 = face;
								}
								else
								{
									bool flag11 = Math.Abs(num10 - area) < 0.0001;
									if (flag11)
									{
										face2 = face;
									}
									else
									{
										bool flag12 = area > num10;
										if (!flag12)
										{
											continue;
										}
										num10 = area;
										face2 = face;
									}
								}
								foreach (XYZ xyz3 in ptlst)
								{
									IntersectionResultArray intersectionResultArray = new IntersectionResultArray();
									Line line = Line.CreateUnbound(xyz3, XYZ.BasisZ);
									SetComparisonResult setComparisonResult = face2.Intersect(line, out intersectionResultArray);
                                    bool flag13 = (int)setComparisonResult == 4 || intersectionResultArray.Size == 0;
									if (!flag13)
									{
										xyz2 = intersectionResultArray.get_Item(0).XYZPoint;
									}
								}
								bool flag14 = xyz == null;
								if (flag14)
								{
									xyz = xyz2;
								}
								else
								{
									bool flag15 = xyz.Z < xyz2.Z;
									if (flag15)
									{
										xyz = xyz2;
									}
								}
							}
						}
					}
					bool flag16 = xyz != null;
					if (flag16)
					{
						num6 = xyz.Z;
						bool flag17 = flag6;
						double num11;
						if (flag17)
						{
							num11 = num3 - num6 + num7 - num9;
						}
						else
						{
							num11 = num6 - num3 - num7 - num8 - num9;
						}
						bool flag18 = num4 == 0.0 || num4 > num11;
						if (flag18)
						{
							num4 = num11;
						}
						break;
					}
				}
				bool flag19 = num4 > 0.0;
				if (flag19)
				{
					num4 = HSFamily.feetToMM(num4);
					selHSDefine.ChangeHighFromBase(num4);
					result = true;
				}
				else
				{
					result = false;
				}
			}
			return result;
		}

		public bool GetHSLinkBeamHigh(ref HSDefineInfo selHSDefine, List<XYZ> ptlst, double dFromBaseHigh)
		{
			bool flag = ptlst.Count == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				Options options = new Options();
				FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
				ICollection<Element> collection = filteredElementCollector.OfClass(typeof(FamilyInstance)).ToElements();
				Document document = this.m_doc;
				IEnumerable<Element> enumerable = from elem in collection
				let familyInstance = elem as FamilyInstance
                                                  where (int)familyInstance.StructuralType == 1
				select familyInstance;
				bool flag2 = enumerable == null || !enumerable.Any<Element>();
				if (flag2)
				{
					List<RevitLinkInstance> allRevitLinkInstancesInDoc = this.GetAllRevitLinkInstancesInDoc();
					IList<Document> list = (from link in allRevitLinkInstancesInDoc
					select link.GetLinkDocument()).ToList<Document>();
					foreach (Autodesk.Revit.DB.Document document2 in list)
					{
						bool flag3 = document2 == null;
						if (!flag3)
						{
							filteredElementCollector = new FilteredElementCollector(document2);
							collection = filteredElementCollector.OfClass(typeof(FamilyInstance)).ToElements();
							bool flag4 = collection.Count == 0;
							if (!flag4)
							{
								document = document2;
								break;
							}
						}
					}
					bool flag5 = collection.Count == 0;
					if (flag5)
					{
						return false;
					}
					enumerable = from elem in collection
					let familyInstance = elem as FamilyInstance
                                 where (int)familyInstance.StructuralType == 1
					select familyInstance;
				}
				bool flag6 = enumerable == null || !enumerable.Any<Element>();
				if (flag6)
				{
					result = false;
				}
				else
				{
					bool flag7 = selHSDefine.IsSupport();
					double num = 0.0;
					try
					{
						Level level = Utils.GetLevel(selHSDefine.m_strElevationName, this.m_doc);
						num = level.Elevation;
					}
					catch (Exception ex)
					{
						return false;
					}
					double num2 = HSFamily.mmToFeet(dFromBaseHigh);
					double num3 = num + ptlst[0].Z;
					bool flag8 = flag7;
					if (flag8)
					{
						num3 += num2;
					}
					else
					{
						num3 -= num2;
					}
					double num4 = 0.0;
					foreach (Element element in enumerable)
					{
						ElementId elementId = element.GetParameter(Autodesk.Revit.DB.BuiltInParameter.INSTANCE_REFERENCE_LEVEL_PARAM).AsElementId();
						Level level2 = document.GetElement(elementId) as Level;
						double elevation = level2.Elevation;
						Parameter parameter = element.GetParameter(Autodesk.Revit.DB.BuiltInParameter.STRUCTURAL_BEAM_END0_ELEVATION);
						Parameter parameter2 = element.GetParameter(Autodesk.Revit.DB.BuiltInParameter.STRUCTURAL_BEAM_END1_ELEVATION);
						double num5 = (parameter.AsDouble() + parameter2.AsDouble()) / 2.0;
						double num6 = elevation + num5;
						double num7 = Utils.GetBeamHigh(element);
						double num8 = Utils.GetBeamWide(element);
						num7 = HSFamily.mmToFeet(num7);
						num8 = HSFamily.mmToFeet(num8);
						double num9 = HSFamily.mmToFeet(selHSDefine.m_dLinkThick);
						bool flag9 = selHSDefine.m_eLinkDevice1 == HSLinkDevice.kLinkDeviceNone;
						if (flag9)
						{
							num9 = 0.0;
						}
						bool flag10 = flag7;
						double num10;
						if (flag10)
						{
							num10 = num3 - num6 + num9;
							bool flag11 = num10 > num2 * 2.0 || num10 <= 0.0;
							if (flag11)
							{
								continue;
							}
						}
						else
						{
							num10 = num6 - num3 - num7 - num9;
							bool flag12 = num10 > num2 * 2.0 || num10 <= 0.0;
							if (flag12)
							{
								continue;
							}
						}
						foreach (XYZ xyz in ptlst)
						{
							LocationCurve locationCurve = element.Location as LocationCurve;
							Curve curve = locationCurve.Curve;
							bool flag13 = curve.Length < 0.001;
							if (!flag13)
							{
								XYZ hyendPoint = curve.GetEndPoint(0);
								XYZ xyz2 = new XYZ(xyz.X, xyz.Y, hyendPoint.Z);
								XYZ closestPointTo = CurveAssistFunc.GetClosestPointTo(this.m_uiApp, curve, xyz2, false);
								XYZ closestPointTo2 = CurveAssistFunc.GetClosestPointTo(this.m_uiApp, curve, xyz2, true);
								bool flag14 = closestPointTo == null || closestPointTo2 == null;
								if (!flag14)
								{
									bool flag15 = !closestPointTo.IsAlmostEqualTo(closestPointTo2);
									if (!flag15)
									{
										double num11 = xyz2.DistanceTo(closestPointTo);
										bool flag16 = num11 > num8 / 2.0;
										if (!flag16)
										{
											bool flag17 = num4 == 0.0 || num4 > num10;
											if (flag17)
											{
												num4 = num10;
											}
											break;
										}
									}
								}
							}
						}
					}
					bool flag18 = num4 > 0.0;
					if (flag18)
					{
						num4 = HSFamily.feetToMM(num4);
						selHSDefine.ChangeHighFromBase(num4);
						result = true;
					}
					else
					{
						result = false;
					}
				}
			}
			return result;
		}

		public void GetHSVerLinkPts(ref List<XYZ> ptlst, ref double dBaseHigh, HSDefineInfo selHSDefine, double dAngle, XYZ ptBase)
		{
			ptlst.Clear();
			double dDistFromGround = selHSDefine.m_dDistFromGround;
			double num = selHSDefine.m_dNetWide / 2.0 + selHSDefine.m_matVer.m_dHigh / 2.0;
			num = HSFamily.mmToFeet(num);
			XYZ xyz = Utils.Vector(dAngle) * num;
			double num2 = selHSDefine.m_dElevationOffset;
			num2 = HSFamily.mmToFeet(num2);
			XYZ xyz2 = new XYZ(ptBase.X, ptBase.Y, num2);
			bool flag = selHSDefine.IsSupport();
			if (flag)
			{
				bool flag2 = selHSDefine.m_eType == HSType.kZJ_DC || selHSDefine.m_eType == HSType.kZJ_PX || selHSDefine.m_eType == HSType.kZJ_DZ;
				if (flag2)
				{
					dBaseHigh = dDistFromGround;
					ptlst.Add(xyz2 + xyz);
					ptlst.Add(xyz2 - xyz);
				}
			}
			else
			{
				bool flag3 = selHSDefine.m_eType == HSType.kDJ_DC || selHSDefine.m_eType == HSType.kDJ_PX || selHSDefine.m_eType == HSType.kDJ_DZ || selHSDefine.m_eType == HSType.kDJ_YC || selHSDefine.m_eType == HSType.kDJ_PX3 || selHSDefine.m_eType == HSType.kDJ_DC3;
				if (flag3)
				{
					dBaseHigh = dDistFromGround;
				}
				bool flag4 = selHSDefine.m_eType == HSType.kDJ_DB || selHSDefine.m_eType == HSType.kDJ_DG || selHSDefine.m_eType == HSType.kDJ_ZJ;
				if (flag4)
				{
					dBaseHigh = selHSDefine.m_dNetHigh[0];
					bool flag5 = selHSDefine.m_eType == HSType.kDJ_ZJ;
					if (flag5)
					{
						ptlst.Add(xyz2 + xyz);
					}
					else
					{
						ptlst.Add(xyz2);
					}
				}
				else
				{
					bool flag6 = selHSDefine.m_eType == HSType.kDJ_GJ || selHSDefine.m_eType == HSType.kDJ_SG || selHSDefine.m_eType == HSType.kDJ_SL;
					if (flag6)
					{
						dBaseHigh = selHSDefine.m_dNetHigh[0];
						ptlst.Add(xyz2 + xyz);
						ptlst.Add(xyz2 - xyz);
					}
					else
					{
						dBaseHigh = dDistFromGround;
						ptlst.Add(xyz2 + xyz);
						ptlst.Add(xyz2 - xyz);
					}
				}
			}
		}

		private void Getinfo_Level(Autodesk.Revit.DB.Document document)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = 0;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document);
			ICollection<Element> collection = filteredElementCollector.OfClass(typeof(Level)).ToElements();
			foreach (Element element in collection)
			{
				Level level = element as Level;
				bool flag = level != null;
				if (flag)
				{
					num++;
					stringBuilder.Append("\nLevel Name: " + level.Name);
					stringBuilder.Append("\n\tElevation: " + level.Elevation);
					stringBuilder.Append("\n\tProject Elevation: " + level.ProjectElevation);
				}
			}
			stringBuilder.Append("\n\n There are " + num + " levels in the document!");
			Utils.MessageBox(stringBuilder.ToString());
		}

		public Level GetUpLevel(Level curLevel)
		{
			return HSDraw.GetUpLevel(curLevel, this.m_doc);
		}

		public static Level GetUpLevel(Level bLevel, Autodesk.Revit.DB.Document doc)
		{
			Level result = null;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfClass(typeof(Level));
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Level level = element as Level;
				bool flag = level == null;
				if (!flag)
				{
					bool flag2 = bLevel == null;
					if (flag2)
					{
						return level;
					}
					bool flag3 = bLevel.Elevation == level.Elevation;
					if (flag3)
					{
						result = level;
					}
					bool flag4 = bLevel.Elevation < level.Elevation;
					if (flag4)
					{
						result = level;
						break;
					}
				}
			}
			return result;
		}

		public static Level GetDownLevel(Level bLevel, Autodesk.Revit.DB.Document doc)
		{
			Level result = null;
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfClass(typeof(Level));
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Level level = element as Level;
				bool flag = level == null;
				if (!flag)
				{
					bool flag2 = bLevel == null;
					if (flag2)
					{
						return level;
					}
					bool flag3 = bLevel.Elevation == level.Elevation;
					if (flag3)
					{
						result = level;
					}
					bool flag4 = bLevel.Elevation > level.Elevation;
					if (flag4)
					{
						result = level;
						break;
					}
				}
			}
			return result;
		}

		public Level GetLevel(string strLevelName)
		{
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(this.m_doc);
			filteredElementCollector.OfClass(typeof(Level));
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Level level = element as Level;
				bool flag = level == null;
				if (!flag)
				{
					bool flag2 = level.Name == strLevelName;
					if (flag2)
					{
						return level;
					}
				}
			}
			return null;
		}

		public static bool GetUpDownLevel(ref Level levelUpElevation, ref Level levelDownElevetion, double dElevation, Autodesk.Revit.DB.Document doc)
		{
			levelUpElevation = null;
			levelDownElevetion = null;
			double num = HSFamily.mmToFeet(dElevation);
			FilteredElementCollector filteredElementCollector = new FilteredElementCollector(doc);
			filteredElementCollector.OfClass(typeof(Level));
			FilteredElementIterator elementIterator = filteredElementCollector.GetElementIterator();
			elementIterator.Reset();
			Level level = null;
			Level level2 = null;
			List<Level> list = new List<Level>();
			while (elementIterator.MoveNext())
			{
				Element element = elementIterator.Current;
				Level item = element as Level;
				list.Add(item);
			}
			bool flag = list.Count < 2;
			bool result;
			if (flag)
			{
				bool flag2 = list.Count == 1;
				if (flag2)
				{
					levelUpElevation = list[0];
					levelDownElevetion = list[0];
				}
				result = false;
			}
			else
			{
				list.Sort(new LevelComparer());
				for (int i = 0; i < list.Count - 1; i++)
				{
					bool flag3 = num >= list[i].Elevation && num < list[i + 1].Elevation;
					if (flag3)
					{
						level = list[i];
						level2 = list[i + 1];
						break;
					}
				}
				bool flag4 = true;
				bool flag5 = level == null || level2 == null;
				if (flag5)
				{
					level = list[list.Count - 1];
					level2 = list[list.Count - 2];
					flag4 = false;
				}
				levelUpElevation = level2;
				levelDownElevetion = level;
				result = flag4;
			}
			return result;
		}

		public static bool GetUpDownLevel(ref double dUpElevation, ref double dDownElevetion, double dElevation, Autodesk.Revit.DB.Document doc)
		{
			dUpElevation = dElevation;
			dDownElevetion = dElevation;
			Level level = null;
			Level level2 = null;
			bool flag = !HSDraw.GetUpDownLevel(ref level, ref level2, dElevation, doc);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = level != null;
				if (flag2)
				{
					dUpElevation = Utils.feetToMM(level.Elevation);
				}
				bool flag3 = level2 != null;
				if (flag3)
				{
					dDownElevetion = Utils.feetToMM(level2.Elevation);
				}
				result = true;
			}
			return result;
		}

		public void GetDistSeparationPts(ref List<XYZ> lstPoint, ref List<double> lstAngle, Curve curve, double dDistStart, double dDistSeparation, bool bConverse = false)
		{
			Line line = curve as Line;
			bool flag = line != null;
			if (flag)
			{
				XYZ xyz = line.GetEndPoint(0);
				XYZ xyz2 = line.GetEndPoint(1);
				if (bConverse)
				{
					XYZ xyz3 = xyz;
					xyz = xyz2;
					xyz2 = xyz3;
				}
				XYZ xyz4 = (xyz2 - xyz).Normalize();
				double num = HSFamily.feetToMM((xyz2 - xyz).GetLength());
				double num2 = num - dDistStart;
				bool flag2 = num2 < 0.0;
				if (!flag2)
				{
					int num3 = (int)(num2 / dDistSeparation) + 1;
					xyz += xyz4 * HSFamily.mmToFeet(dDistStart);
					XYZ vt = xyz4.CrossProduct(XYZ.BasisZ);
					double num4 = Utils.Angle(vt);
					if (bConverse)
					{
						num4 += Math.PI;
					}
					for (int i = 0; i < num3; i++)
					{
						XYZ item = xyz + xyz4 * HSFamily.mmToFeet(dDistSeparation) * (double)i;
						lstPoint.Add(item);
						lstAngle.Add(num4);
					}
				}
			}
			else
			{
				Arc arc = curve as Arc;
				bool flag3 = arc == null;
				if (!flag3)
				{
					double length = arc.Length;
					XYZ center = arc.Center;
					double radius = arc.Radius;
					XYZ vect = arc.GetEndPoint(0);
					double num5 = HSFamily.mmToFeet(dDistStart);
					double num6 = HSFamily.mmToFeet(dDistSeparation);
					double num7 = num6 / radius;
					double num8 = length - num5;
					bool flag4 = num8 < 0.0;
					if (!flag4)
					{
						int num9 = (int)(num8 / num6) + 1;
						vect = HSFamily.Rotate(vect, XYZ.BasisZ, num5 / radius);
						for (int j = 0; j < num9; j++)
						{
							XYZ xyz5 = HSFamily.Rotate(vect, XYZ.BasisZ, num7 * (double)j / radius);
							lstPoint.Add(xyz5);
							XYZ xyz6 = (xyz5 - center).CrossProduct(XYZ.BasisZ);
							double item2 = XYZ.BasisX.AngleOnPlaneTo(xyz6, XYZ.BasisZ);
							lstAngle.Add(item2);
						}
					}
				}
			}
		}

		public double GetPipeElevaton(Element ele)
		{
			double num = 0.0;
			Parameter parameter = ele.GetParameter(Autodesk.Revit.DB.BuiltInParameter.RBS_START_LEVEL_PARAM);
			bool flag = parameter != null;
			if (flag)
			{
				Level level = (Level)this.m_doc.GetElement(parameter.AsElementId());
				bool flag2 = level != null;
				if (flag2)
				{
					num = HSFamily.feetToMM(level.Elevation);
				}
			}
			Parameter parameter2 = ele.GetParameter(Autodesk.Revit.DB.BuiltInParameter.RBS_OFFSET_PARAM);
			bool flag3 = parameter2 != null;
			if (flag3)
			{
				num += HSFamily.feetToMM(parameter2.AsDouble());
			}
			return Utils.DoublePrecision(num, 1);
		}

		public bool DrawBySectionLine(PipeSelect secSelectInfo, bool bSelectPipesSection, HSDrawType drawType)
		{
			Autodesk.Revit.DB.View activeView = this.m_doc.ActiveView;
            bool flag = (int)activeView.ViewType != 1;
			bool result;
			if (flag)
			{
				YJKMessageBox.Show("请在平面视图下进行操作！");
				result = false;
			}
			else
			{
				FamilySymbol hssymbol = this.GetHSSymbol();
				bool flag2 = hssymbol == null;
				if (flag2)
				{
					result = false;
				}
				else
				{
					for (;;)
					{
						XYZ xyz = null;
						XYZ xyz2 = null;
						try
						{
							xyz = Utils.PtTo2d(this.m_selection.PickPoint("请选择布置支吊架剖面位置的起点"));
							xyz2 = Utils.PtTo2d(this.m_selection.PickPoint("请选择布置支吊架剖面位置的终点"));
						}
						catch (Exception ex)
						{
							return false;
						}
						bool flag3 = xyz.IsAlmostEqualTo(xyz2);
						if (flag3)
						{
							Utils.MessageBox("两点重合，请重新选择");
						}
						else
						{
							PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
							pipeSelect.SelectPipeByLine(xyz, xyz2);
							bool flag4 = pipeSelect.m_listSecSel.Count == 0;
							if (flag4)
							{
								break;
							}
							Line lnSectionCut = Line.CreateBound(xyz, xyz2);
							double num = 0.0;
							DlgHSDesign.AutoAdjustHSSectionSizeByDefine(ref xyz2, ref num, ref this.m_HSTypeManage.m_hsTypeDefault, this.m_doc, pipeSelect, bSelectPipesSection, drawType, lnSectionCut);
							XYZ ptPosition = pipeSelect.m_ptPosition;
							double dAngle = pipeSelect.m_dAngle;
							Transaction transaction = new Transaction(this.m_doc, "CreateHS");
							transaction.Start();
							this.NewHS(ptPosition, dAngle, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
							transaction.Commit();
						}
					}
					result = true;
				}
			}
			return result;
		}

		public static List<Connector> GetConnectors(Element element)
		{
			List<Connector> list = new List<Connector>();
			ConnectorSet cs = new ConnectorSet();
			bool flag = element == null;
			List<Connector> result;
			if (flag)
			{
				result = null;
			}
			else
			{
				FamilyInstance familyInstance = element as FamilyInstance;
				bool flag2 = familyInstance != null && familyInstance.MEPModel != null;
				if (flag2)
				{
					cs = familyInstance.MEPModel.ConnectorManager.Connectors;
				}
				MEPCurve mepcurve = element as MEPCurve;
				bool flag3 = mepcurve != null;
				if (flag3)
				{
					cs = mepcurve.ConnectorManager.Connectors;
				}
				list = HSDraw.ConnectorSetToList(cs);
				result = list;
			}
			return result;
		}

		public static List<Connector> ConnectorSetToList(ConnectorSet cs)
		{
			List<Connector> list = new List<Connector>();
			ConnectorSetIterator connectorSetIterator = cs.ForwardIterator();
			while (connectorSetIterator.MoveNext())
			{
				object obj = connectorSetIterator.Current;
				Connector item = obj as Connector;
				list.Add(item);
			}
			return list;
		}

		private void GetPipeOnSameLine(ref Dictionary<Element, bool> dictFind, Element elePipe, bool bNearStart)
		{
			foreach (KeyValuePair<Element, bool> keyValuePair in dictFind)
			{
				bool flag = keyValuePair.Key.Id == elePipe.Id;
				if (flag)
				{
					return;
				}
			}
			dictFind.Add(elePipe, bNearStart);
			List<Connector> connectors = HSDraw.GetConnectors(elePipe);
			foreach (Connector connector in connectors)
			{
				ConnectorSet allRefs = connector.AllRefs;
				bool flag2 = allRefs != null;
				if (flag2)
				{
					foreach (object obj in allRefs)
					{
						Connector connector2 = (Connector)obj;
						Element owner = connector2.Owner;
						bool flag3 = owner == null;
						if (!flag3)
						{
							bool flag4 = owner.Id == elePipe.Id;
							if (!flag4)
							{
								List<Connector> connectors2 = HSDraw.GetConnectors(owner);
								foreach (Connector connector3 in connectors2)
								{
									bool flag5 = connector3.AllRefs == null;
									if (!flag5)
									{
										foreach (object obj2 in connector3.AllRefs)
										{
											Connector connector4 = (Connector)obj2;
											Element element = connector4.Owner;
											bool flag6 = element == null;
											if (!flag6)
											{
												bool flag7 = element.Id == owner.Id || element.Id == elePipe.Id;
												if (!flag7)
												{
													FamilyInstance familyInstance = element as FamilyInstance;
													bool flag8 = familyInstance != null;
													if (flag8)
													{
														List<Connector> connectors3 = HSDraw.GetConnectors(familyInstance);
														foreach (Connector connector5 in connectors3)
														{
															bool flag9 = connector5.AllRefs == null;
															if (!flag9)
															{
																foreach (object obj3 in connector5.AllRefs)
																{
																	Connector connector6 = (Connector)obj3;
																	Element owner2 = connector6.Owner;
																	bool flag10 = owner2 == null;
																	if (!flag10)
																	{
																		bool flag11 = !Utils.Is2PipeParallel(elePipe, owner2);
																		if (!flag11)
																		{
																			element = owner2;
																		}
																	}
																}
															}
														}
													}
													bool flag12 = false;
													foreach (KeyValuePair<Element, bool> keyValuePair2 in dictFind)
													{
														bool flag13 = keyValuePair2.Key.Id == element.Id;
														if (flag13)
														{
															flag12 = true;
															break;
														}
													}
													bool flag14 = flag12;
													if (!flag14)
													{
														bool flag15 = dictFind.ContainsKey(element) || elePipe == element;
														if (!flag15)
														{
															bool flag16 = !Utils.Is2PipeParallel(elePipe, element);
															if (!flag16)
															{
																bool bNearStart2 = Utils.Is2PipeCodirectional(elePipe, element) ? bNearStart : (!bNearStart);
																this.GetPipeOnSameLine(ref dictFind, element, bNearStart2);
															}
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
				}
			}
		}

		public bool DrawByPipe(PipeSelect secSelectInfo, bool bSelectPipesSection, HSDrawType drawType)
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			DlgHSDistSet dlgHSDistSet = new DlgHSDistSet(HSDraw.m_dDistStart, HSDraw.m_dDistSeparation, secSelectInfo.m_listElementSel.Count<Element>());
			dlgHSDistSet.Show(HSManage._hWndRevit);
			HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
			for (;;)
			{
				bool bIncludeVerPipe = this.m_HSTypeManage.m_hsTypeDefault.m_eType == HSType.kZJ_CB;
				Element element = pipeSelect.SelectSinglePipeAll(bIncludeVerPipe, "请选择布置支吊架的风管、管道、桥架、线管");
				bool flag = element == null;
				if (flag)
				{
					break;
				}
				bool flag2 = Utils.IsVerticalPipe(element);
				if (flag2)
				{
					bool flag3 = this.m_HSTypeManage.m_hsTypeDefault.m_eType != HSType.kZJ_CB;
					if (flag3)
					{
						goto Block_3;
					}
					this.m_HSTypeManage.m_hsTypeDefault.m_bIsVerPipe = true;
				}
				MEPCurve mepcurve = element as MEPCurve;
				bool flag4 = mepcurve == null;
				if (!flag4)
				{
					XYZ xyz = pipeSelect.m_ptPick;
					LocationCurve locationCurve = mepcurve.Location as LocationCurve;
					Curve curve = locationCurve.Curve;
					xyz = Utils.getCloestPointOnCurve(xyz, curve, true);
					bool flag5 = Utils.isPointNearCurveStart(xyz, curve);
					Dictionary<Element, bool> dictionary = new Dictionary<Element, bool>();
					this.GetPipeOnSameLine(ref dictionary, element, flag5);
					HSDraw.m_dDistStart = dlgHSDistSet.GetDistStart();
					HSDraw.m_dDistSeparation = dlgHSDistSet.GetDistSeparation();
					HSDraw.isAuto = dlgHSDistSet.GetIsAuto();
					Transaction transaction = new Transaction(this.m_doc, "CreateHS");
					transaction.Start();
					foreach (KeyValuePair<Element, bool> keyValuePair in dictionary)
					{
						double dDistSeparation = HSDraw.m_dDistSeparation;
						bool flag6 = this.isSpecailCableTray(element, hsTypeDefault) && HSDraw.isAuto;
						if (flag6)
						{
							this.setCableTrayParameter(ref this.m_HSTypeManage.m_hsTypeDefault, hsTypeDefault.m_eType == HSType.kDJ_DC && hsTypeDefault.m_nFloorNum == 1);
						}
						else
						{
							bool flag7 = this.isSpecailDuct(element, hsTypeDefault) && HSDraw.isAuto;
							if (flag7)
							{
								this.setDuctParameter(ref this.m_HSTypeManage.m_hsTypeDefault, (Duct)element);
							}
							else
							{
								bool flag8 = this.IsSpecailPipe(element, hsTypeDefault) && HSDraw.isAuto;
								if (flag8)
								{
									double num = 0.0;
									this.SetPipeParameterAndGetLayDis(ref hsTypeDefault, ref num, element as Pipe);
									dDistSeparation = num;
								}
							}
						}
						this.isTran = false;
						FamilySymbol hssymbol = this.GetHSSymbol();
						this.isTran = true;
						bool flag9 = hssymbol == null;
						if (flag9)
						{
							return false;
						}
						element = keyValuePair.Key;
						flag5 = keyValuePair.Value;
						XYZ xyz2 = xyz;
						double num2 = 0.0;
						pipeSelect.m_listElementSel.Clear();
						pipeSelect.m_listElementSel.Add(element);
						DlgHSDesign.AutoAdjustHSSectionSizeByDefine(ref xyz2, ref num2, ref this.m_HSTypeManage.m_hsTypeDefault, this.m_doc, pipeSelect, bSelectPipesSection, drawType, null);
						mepcurve = (element as MEPCurve);
						locationCurve = (mepcurve.Location as LocationCurve);
						List<XYZ> list = new List<XYZ>();
						List<double> list2 = new List<double>();
						bool flag10 = element is CableTray && HSDraw.isAuto;
						if (flag10)
						{
							dDistSeparation = 2000.0;
						}
						else
						{
							bool flag11 = element is Duct && HSDraw.isAuto;
							if (flag11)
							{
								YJKPiping<Duct> hypiping = new YJKPiping<Duct>(element as Duct);
								double weightOrDiameter = hypiping.GetWeightOrDiameter();
								double heightOrDiameter = hypiping.GetHeightOrDiameter();
								double num3 = (weightOrDiameter > heightOrDiameter) ? weightOrDiameter : heightOrDiameter;
								bool flag12 = Math.Round(num3 * 304.8, 0) > 400.0;
								if (flag12)
								{
									dDistSeparation = 3000.0;
								}
								else
								{
									dDistSeparation = 4000.0;
								}
							}
						}
						this.GetDistSeparationPts(ref list, ref list2, locationCurve.Curve, HSDraw.m_dDistStart, dDistSeparation, !flag5);
						bool flag13 = false;
						List<PipeSectionDef> selSecLst = secSelectInfo.GetSelSecLst();
						bool flag14 = selSecLst.Count > 0;
						if (flag14)
						{
							foreach (PipeSectionDef pipeSectionDef in selSecLst)
							{
								bool flag15 = pipeSectionDef.m_ElementId == element.Id;
								if (flag15)
								{
									flag13 = true;
									break;
								}
							}
						}
						XYZ xyz3 = locationCurve.Curve.GetEndPoint(0);
						int i = 0;
						while (i < list.Count)
						{
							double num4 = list[i].Z - xyz3.Z;
							xyz3 = list[i];
							bool flag16 = this.m_HSTypeManage.m_hsTypeDefault.IsSupport();
							if (flag16)
							{
								num4 *= -1.0;
							}
							double dHighFromBaseChanged = Utils.feetToMM(-num4);
							this.m_HSTypeManage.m_hsTypeDefault.ChangeHighValueFromBaseOnly(dHighFromBaseChanged);
							XYZ xyz4 = list[i];
							bool flag17 = flag13 && secSelectInfo.m_listSecSel.Count > 1;
							if (flag17)
							{
								xyz4 = secSelectInfo.GetDrawMidPoint(xyz4);
							}
							double num5 = list2[i];
							bool bMirrored = this.m_HSTypeManage.m_hsTypeDefault.m_bMirrored;
							if (bMirrored)
							{
								num5 += Math.PI;
							}
							XYZ xyz5 = Utils.Vector(num5);
							HSType eType = this.m_HSTypeManage.m_hsTypeDefault.m_eType;
							if (eType == HSType.kZJ_PX)
							{
								goto IL_572;
							}
							if (eType != HSType.kZJ_CB)
							{
								switch (eType)
								{
								case HSType.kDJ_PX:
								case HSType.kDJ_DB:
								case HSType.kDJ_SG:
								case HSType.kDJ_SL:
								case HSType.kDJ_DC3:
									goto IL_572;
								}
							}
							else
							{
								xyz4 -= xyz5 * HSFamily.mmToFeet(this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopThick + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopDiameter / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dGapHor);
								this.m_HSTypeManage.m_hsTypeDefault.m_dElevationOffset = HSFamily.feetToMM(xyz4.Z);
							}
							IL_626:
							this.NewHS(xyz4, num5, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
							i++;
							continue;
							IL_572:
							xyz4 -= xyz5 * HSFamily.mmToFeet(this.m_HSTypeManage.m_hsTypeDefault.m_dHangerDBOffsetDist);
							goto IL_626;
						}
					}
					transaction.Commit();
				}
			}
			dlgHSDistSet.Close();
			return false;
			Block_3:
			Utils.MessageBox("请选择非竖直管道");
			dlgHSDistSet.Close();
			return false;
		}

		public static XYZ TransformPoint(XYZ point, Transform transform)
		{
			double x = point.X;
			double y = point.Y;
			double z = point.Z;
			XYZ xyz = transform.get_Basis(0);
			XYZ xyz2 = transform.get_Basis(1);
			XYZ xyz3 = transform.get_Basis(2);
			XYZ origin = transform.Origin;
			double num = x * xyz.X + y * xyz2.X + z * xyz3.X + origin.X;
			double num2 = x * xyz.Y + y * xyz2.Y + z * xyz3.Y + origin.Y;
			double num3 = x * xyz.Z + y * xyz2.Z + z * xyz3.Z + origin.Z;
			return new XYZ(num, num2, num3);
		}

		public bool DrawByWall(PipeSelect secSelectInfo)
		{
			HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
			FamilySymbol hssymbol = this.GetHSSymbol();
			bool flag = hssymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				DlgHSDistSet dlgHSDistSet = new DlgHSDistSet(HSDraw.m_dDistStart, HSDraw.m_dDistSeparation);
				dlgHSDistSet.Show(HSManage._hWndRevit);
				Level level = null;
				Level level2 = null;
				XYZ xyz = new XYZ();
				PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
				Element element = pipeSelect.SelectSingleWall(ref xyz, "请选择布置支吊架的墙");
				bool flag2 = element == null;
				if (flag2)
				{
					dlgHSDistSet.Close();
					result = false;
				}
				else
				{
					Wall wall = element as Wall;
					Transform transform = null;
					Curve curve = null;
					bool flag3 = wall == null;
					if (flag3)
					{
						RevitLinkInstance revitLinkInstance = element as RevitLinkInstance;
						bool flag4 = revitLinkInstance == null;
						if (flag4)
						{
							dlgHSDistSet.Close();
							return false;
						}
						transform = revitLinkInstance.GetTotalTransform();
						revitLinkInstance.GetLinkDocument();
						Document linkDocument = revitLinkInstance.GetLinkDocument();
						IList<Element> elementByCategory = YJKElementFilter.GetElementByCategory(linkDocument, typeof(Wall), BuiltInCategory.OST_Walls);
						foreach (Element element2 in elementByCategory)
						{
							Wall wall2 = element2 as Wall;
							LocationCurve locationCurve = element2.Location as LocationCurve;
							curve = locationCurve.Curve;
							curve = RevitVersionFuncs.CreateTransformed(transform, curve);
							XYZ endPoint = curve.GetEndPoint(0);
							xyz = Utils.SetPtZ(xyz, endPoint.Z);
							double width = wall2.WallType.Width;
							XYZ xyzpoint = curve.Project(xyz).XYZPoint;
							double num = xyzpoint.DistanceTo(xyz);
							bool flag5 = num <= width / 2.0;
							if (flag5)
							{
								wall = wall2;
								curve = locationCurve.Curve;
								break;
							}
						}
					}
					else
					{
						LocationCurve locationCurve2 = wall.Location as LocationCurve;
						curve = locationCurve2.Curve;
					}
					bool flag6 = wall == null;
					if (flag6)
					{
						dlgHSDistSet.Close();
						result = false;
					}
					else
					{
						LocationCurve locationCurve3 = wall.Location as LocationCurve;
						double num2 = 0.0;
						WallType wallType = wall.WallType;
						num2 = HSFamily.feetToMM(wallType.Width);
						bool flag7 = !HSDraw.GetUpDownLevel(ref level, ref level2, this.m_HSTypeManage.m_hsTypeDefault.m_dElevation, this.m_doc);
						if (flag7)
						{
						}
						HSDraw.m_dDistStart = dlgHSDistSet.GetDistStart();
						HSDraw.m_dDistSeparation = dlgHSDistSet.GetDistSeparation();
						List<PipeSectionDef> selSecLst = secSelectInfo.GetSelSecLst();
						Element element3 = null;
						PipeSectionDef pipeSectionDef = default(PipeSectionDef);
						bool flag8 = selSecLst.Count > 0;
						if (flag8)
						{
							pipeSectionDef = selSecLst[0];
							element3 = this.m_doc.GetElement(pipeSectionDef.m_ElementId);
							foreach (PipeSectionDef pipeSectionDef2 in selSecLst)
							{
								bool flag9 = pipeSectionDef2.m_ElementId == element.Id;
								if (flag9)
								{
									break;
								}
							}
						}
						List<XYZ> list = new List<XYZ>();
						List<double> list2 = new List<double>();
						bool flag10 = element3 != null;
						if (flag10)
						{
							LocationCurve locationCurve4 = element3.Location as LocationCurve;
							bool flag11 = locationCurve4 != null;
							if (flag11)
							{
								locationCurve3 = locationCurve4;
							}
						}
						XYZ ptIn = xyz;
						Curve curve2 = locationCurve3.Curve;
						ptIn = Utils.getCloestPointOnCurve(ptIn, curve2, true);
						bool flag12 = Utils.isPointNearCurveStart(ptIn, curve2);
						this.GetDistSeparationPts(ref list, ref list2, locationCurve3.Curve, HSDraw.m_dDistStart, HSDraw.m_dDistSeparation, !flag12);
						Level level3 = Utils.GetLevel(hsTypeDefault.m_strElevationName, this.m_doc);
						double num3 = 0.0;
						bool flag13 = level3 != null;
						if (flag13)
						{
							num3 = level3.Elevation;
						}
						Transaction transaction = new Transaction(this.m_doc, "CreateHS");
						transaction.Start();
						double num4 = 0.0;
						bool flag14 = hsTypeDefault.m_eLinkDevice1 != HSLinkDevice.kLinkDeviceNone && hsTypeDefault.m_eType != HSType.kZJ_SJ;
						if (flag14)
						{
							num4 = hsTypeDefault.m_dLinkThick;
						}
						double dNetWide = this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide;
						XYZ xyz2 = curve2.GetEndPoint(0);
						for (int i = 0; i < list.Count; i++)
						{
							double num5 = list[i].Z - xyz2.Z;
							xyz2 = list[i];
							bool flag15 = this.m_HSTypeManage.m_hsTypeDefault.IsSupport();
							if (flag15)
							{
								num5 *= -1.0;
							}
							this.m_HSTypeManage.m_hsTypeDefault.ChangeHighValueFromBaseOnly(Utils.feetToMM(-num5));
							XYZ xyz3 = list[i];
							double num6 = Utils.GetWallTypeStructureThickFromCenter(wall, xyz3, false);
							bool flag16 = hsTypeDefault.m_eType == HSType.kZJ_SJ;
							if (flag16)
							{
								num6 = num2 / 2.0;
							}
							bool bMirrored = hsTypeDefault.m_bMirrored;
							double num7 = list2[i];
							XYZ xyz4 = Utils.Vector(num7);
							XYZ endPoint2 = curve.GetEndPoint(0);
							XYZ endPoint3 = curve.GetEndPoint(1);
							XYZ xyz5 = new XYZ(xyz3.X, xyz3.Y, endPoint2.Z);
							XYZ xyzpoint2 = curve.Project(xyz5).XYZPoint;
							Line line = curve as Line;
							bool flag17 = line != null;
							XYZ xyzpoint3;
							if (flag17)
							{
								Line line2 = Line.CreateUnbound(endPoint2, endPoint3 - endPoint2);
								xyzpoint3 = line2.Project(xyz5).XYZPoint;
							}
							else
							{
								Arc arc = curve as Arc;
								Plane plane = RevitVersionFuncs.CreatePlanByNormalAndOrigin(arc.Normal, arc.Center);
								Arc arc2 = Arc.Create(plane, arc.Radius, 0.0, Math.PI*2);
								xyzpoint3 = arc2.Project(xyz5).XYZPoint;
							}
							bool flag18 = !xyzpoint3.IsAlmostEqualTo(xyzpoint2);
							if (!flag18)
							{
								bool flag19 = hsTypeDefault.m_eType == HSType.kZJ_CB;
								double num10;
								if (flag19)
								{
									double num8 = HSFamily.feetToMM(xyzpoint2.DistanceTo(xyz5)) - num6;
									num8 -= num4;
									num8 -= hsTypeDefault.m_dGapHor;
									num8 -= hsTypeDefault.m_dLoopThick;
									num8 -= hsTypeDefault.m_dLoopDiameter / 2.0;
									hsTypeDefault.m_dNetWide = num8;
									XYZ xyz6 = Utils.PtTo2d(locationCurve3.Curve.GetEndPoint(0));
									XYZ xyz7 = Utils.PtTo2d(locationCurve3.Curve.GetEndPoint(1));
									hsTypeDefault.m_bIsVerPipe = xyz6.IsAlmostEqualTo(xyz7);
									double num9 = ((pipeSectionDef.m_dHigh > pipeSectionDef.m_dWide) ? pipeSectionDef.m_dHigh : pipeSectionDef.m_dWide) / 2.0;
									hsTypeDefault.m_dElevationOffset = HSFamily.feetToMM(xyz3.Z - num3);
									hsTypeDefault.m_strElevationName = pipeSectionDef.m_strLevelName;
									xyz4 = (xyzpoint2 - xyz5).Normalize();
									num7 = Utils.Angle(xyz4);
									xyz3 = xyzpoint3;
									num10 = num6;
									num10 += num4;
									num10 += hsTypeDefault.m_dNetWide / 2.0;
									this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide = num8;
								}
								else
								{
									xyz3 = xyzpoint3;
									double num11 = num6;
									num11 += num4;
									num11 += hsTypeDefault.m_dNetWide / 2.0;
									XYZ xyz8 = Utils.PtTo2d(locationCurve3.Curve.GetEndPoint(0));
									XYZ xyz9 = Utils.PtTo2d(locationCurve3.Curve.GetEndPoint(1));
									hsTypeDefault.m_bIsVerPipe = xyz8.IsAlmostEqualTo(xyz9);
									num10 = num11;
									xyz4 = (xyzpoint2 - xyz5).Normalize();
									num7 = Utils.Angle(xyz4);
									bool flag20 = hsTypeDefault.m_eType == HSType.kZJ_SJ;
									if (flag20)
									{
										string strCode = hsTypeDefault.m_matVer.m_strCode;
										string strCode2 = hsTypeDefault.m_matHor.m_strCode;
										bool flag21 = hsTypeDefault.m_eLinkType == HSLinkType.kLinkCG && strCode == "B";
										if (flag21)
										{
											num10 += hsTypeDefault.m_matVer.m_dThick;
										}
										else
										{
											num10 += hsTypeDefault.m_matVer.m_dHigh;
										}
									}
								}
								bool flag22 = !bMirrored;
								if (flag22)
								{
									xyz4 *= -1.0;
								}
								XYZ xyz10 = xyz3;
								xyz3 += xyz4 * HSFamily.mmToFeet(num10);
								bool flag23 = !bMirrored;
								if (flag23)
								{
									num7 += Math.PI;
								}
								bool flag24 = hsTypeDefault.m_eType != HSType.kZJ_CB;
								if (flag24)
								{
									bool bIsVerPipe = hsTypeDefault.m_bIsVerPipe;
									if (bIsVerPipe)
									{
										Utils.MessageBox("不处理立管，请重新选择！");
										dlgHSDistSet.Close();
										transaction.Commit();
										return false;
									}
									XYZ drawMidPoint = secSelectInfo.GetDrawMidPoint(xyz3);
									XYZ xyz11 = Utils.PtTo2d(xyz3 - drawMidPoint);
									double num12 = Utils.feetToMM(xyz11.GetLength());
									this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide = dNetWide + num12;
									xyz3 = xyz10 + xyz4 * HSFamily.mmToFeet(num10 - dNetWide / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide / 2.0);
								}
								bool flag25 = transform != null;
								if (flag25)
								{
									xyz3 = HSDraw.TransformPoint(xyz3, transform);
								}
								try
								{
									this.NewHS(xyz3, num7, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
								}
								catch (Exception)
								{
									dlgHSDistSet.Close();
									transaction.Commit();
									return false;
								}
								this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide = dNetWide;
							}
						}
						transaction.Commit();
						dlgHSDistSet.Close();
						result = true;
					}
				}
			}
			return result;
		}

		public bool DrawBy2Pipe()
		{
			FamilySymbol hssymbol = this.GetHSSymbol();
			bool flag = hssymbol == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
				DlgHSDistSet dlgHSDistSet = new DlgHSDistSet(HSDraw.m_dDistStart, HSDraw.m_dDistSeparation);
				dlgHSDistSet.Show(HSManage._hWndRevit);
				for (;;)
				{
					Element element = pipeSelect.SelectSinglePipeAll(false, "请选择布置支吊架的风管、管道、桥架、线管等，作为第一个边界线");
					bool flag2 = element == null;
					if (flag2)
					{
						break;
					}
					Element element2 = pipeSelect.SelectSinglePipeAll(false, "请选择布置支吊架的另一风管、管道、桥架、线管等，作为第二个边界线");
					bool flag3 = element2 == null;
					if (flag3)
					{
						goto Block_3;
					}
					bool flag4 = Utils.IsVerticalPipe(element) || Utils.IsVerticalPipe(element2);
					if (flag4)
					{
						goto Block_5;
					}
					Level level = null;
					Level level2 = null;
					bool flag5 = !HSDraw.GetUpDownLevel(ref level, ref level2, this.m_HSTypeManage.m_hsTypeDefault.m_dElevation, this.m_doc);
					if (flag5)
					{
						double pipeElevaton = this.GetPipeElevaton(element);
					}
					pipeSelect.m_listElementSel.Clear();
					pipeSelect.m_listElementSel.Add(element);
					pipeSelect.m_listElementSel.Add(element2);
					pipeSelect.GetSecInfoFromSelPipes();
					MEPCurve mepcurve = element as MEPCurve;
					bool flag6 = mepcurve == null;
					if (!flag6)
					{
						LocationCurve locationCurve = mepcurve.Location as LocationCurve;
						XYZ endPoint = locationCurve.Curve.GetEndPoint(0);
						XYZ xyz = Utils.PtTo2d(endPoint);
						XYZ xyz2 = Utils.PtTo2d(locationCurve.Curve.GetEndPoint(1));
						MEPCurve mepcurve2 = element2 as MEPCurve;
						LocationCurve locationCurve2 = mepcurve2.Location as LocationCurve;
						XYZ xyz3 = Utils.PtTo2d(Utils.getCloestPointOnCurve(endPoint, locationCurve2.Curve, true));
						XYZ ptIn = pipeSelect.m_ptPick;
						Curve curve = locationCurve2.Curve;
						ptIn = Utils.getCloestPointOnCurve(ptIn, curve, true);
						bool flag7 = Utils.isPointNearCurveStart(ptIn, curve);
						bool flag8 = !Utils.Is2PipeParallel(element, element2);
						if (flag8)
						{
							goto Block_8;
						}
						XYZ xyz4 = (xyz3 - xyz) / 2.0;
						double num = Utils.feetToMM(xyz3.DistanceTo(xyz));
						PipeSectionDef pipeSectionSize = PipeSelect.GetPipeSectionSize(element, this.m_doc);
						PipeSectionDef pipeSectionSize2 = PipeSelect.GetPipeSectionSize(element2, this.m_doc);
						num += pipeSectionSize.m_dWide / 2.0;
						num += pipeSectionSize2.m_dWide / 2.0;
						double mmVal = num / 2.0 - pipeSectionSize.m_dWide / 2.0;
						xyz4 = xyz4.Normalize() * Utils.mmToFeet(mmVal);
						this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide = num;
						bool flag9 = this.m_HSTypeManage.m_hsTypeDefault.m_dOffsetX > num;
						if (flag9)
						{
							this.m_HSTypeManage.m_hsTypeDefault.m_dOffsetX = num / 2.0;
						}
						HSDraw.m_dDistStart = dlgHSDistSet.GetDistStart();
						HSDraw.m_dDistSeparation = dlgHSDistSet.GetDistSeparation();
						List<XYZ> list = new List<XYZ>();
						List<double> list2 = new List<double>();
						this.GetDistSeparationPts(ref list, ref list2, locationCurve.Curve, HSDraw.m_dDistStart, HSDraw.m_dDistSeparation, !flag7);
						Transaction transaction = new Transaction(this.m_doc, "CreateHS");
						transaction.Start();
						XYZ xyz5 = endPoint;
						for (int i = 0; i < list.Count; i++)
						{
							double num2 = list[i].Z - xyz5.Z;
							xyz5 = list[i];
							XYZ ptBase = list[i] + xyz4;
							double num3 = list2[i];
							bool bMirrored = this.m_HSTypeManage.m_hsTypeDefault.m_bMirrored;
							if (bMirrored)
							{
								num3 += Math.PI;
							}
							bool flag10 = this.m_HSTypeManage.m_hsTypeDefault.IsSupport();
							if (flag10)
							{
								num2 *= -1.0;
							}
							this.m_HSTypeManage.m_hsTypeDefault.ChangeHighValueFromBaseOnly(Utils.feetToMM(-num2));
							this.NewHS(ptBase, num3, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
						}
						transaction.Commit();
					}
				}
				dlgHSDistSet.Close();
				return false;
				Block_3:
				dlgHSDistSet.Close();
				return false;
				Block_5:
				Utils.MessageBox("请选择非竖直管道");
				dlgHSDistSet.Close();
				return false;
				Block_8:
				Utils.MessageBox("两个管道不平行");
				dlgHSDistSet.Close();
				result = false;
			}
			return result;
		}

		public bool DrawByCurve()
		{
			FamilySymbol hssymbol = this.GetHSSymbol();
			bool flag = hssymbol == null;
			bool result;
			if (flag)
			{
				result = true;
			}
			else
			{
				DlgHSDistSet dlgHSDistSet = new DlgHSDistSet(HSDraw.m_dDistStart, HSDraw.m_dDistSeparation);
				dlgHSDistSet.Show(HSManage._hWndRevit);
				int wMsg = 7;
				HSDraw.SendMessage(HSManage._hWndRevit.Handle, wMsg, IntPtr.Zero, IntPtr.Zero);
				for (;;)
				{
					XYZ xyz = XYZ.Zero;
					XYZ xyz2 = XYZ.Zero;
					try
					{
						xyz = this.m_selection.PickPoint("请选择布置支吊架中心线起点");
						xyz2 = this.m_selection.PickPoint("请选择布置支吊架中心线终点");
					}
					catch (Exception ex)
					{
						dlgHSDistSet.Close();
						result = false;
						break;
					}
					bool flag2 = xyz.DistanceTo(xyz2) < 1.0;
					if (flag2)
					{
						Utils.MessageBox("长度太短");
					}
					else
					{
						Line curve = Line.CreateBound(xyz, xyz2);
						HSDraw.m_dDistStart = dlgHSDistSet.GetDistStart();
						HSDraw.m_dDistSeparation = dlgHSDistSet.GetDistSeparation();
						List<XYZ> list = new List<XYZ>();
						List<double> list2 = new List<double>();
						this.GetDistSeparationPts(ref list, ref list2, curve, HSDraw.m_dDistStart, HSDraw.m_dDistSeparation, false);
						Transaction transaction = new Transaction(this.m_doc, "CreateHS");
						transaction.Start();
						for (int i = 0; i < list.Count; i++)
						{
							XYZ xyz3 = list[i];
							double num = list2[i];
							bool bMirrored = this.m_HSTypeManage.m_hsTypeDefault.m_bMirrored;
							if (bMirrored)
							{
								num += Math.PI;
							}
							bool flag3 = this.m_HSTypeManage.m_hsTypeDefault.m_eType == HSType.kZJ_CB;
							if (flag3)
							{
								XYZ xyz4 = Utils.Vector(num);
								xyz3 -= xyz4 * HSFamily.mmToFeet(this.m_HSTypeManage.m_hsTypeDefault.m_dNetWide / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopThick + this.m_HSTypeManage.m_hsTypeDefault.m_dLoopDiameter / 2.0 + this.m_HSTypeManage.m_hsTypeDefault.m_dGapHor);
							}
							this.NewHS(xyz3, num, hssymbol, ref this.m_HSTypeManage.m_hsTypeDefault, null);
						}
						transaction.Commit();
					}
				}
			}
			return result;
		}

		public double GetHSPositionAngle(Element selHS)
		{
			double result = 0.0;
			XYZ zero = XYZ.Zero;
			this.GetHSLocation(ref result, ref zero, selHS);
			return result;
		}

		public XYZ GetHSPositionPoint(Element selHS)
		{
			double num = 0.0;
			XYZ zero = XYZ.Zero;
			this.GetHSLocation(ref num, ref zero, selHS);
			return zero;
		}

		public bool GetHSLocation(ref double dHSAngle, ref XYZ ptHSPosition, Element selHS)
		{
			ptHSPosition = null;
			dHSAngle = 0.0;
			Location location = selHS.Location;
			LocationPoint locationPoint = location as LocationPoint;
			bool flag = locationPoint != null;
			bool result;
			if (flag)
			{
				ptHSPosition = Utils.PtTo2d(locationPoint.Point);
				dHSAngle = locationPoint.Rotation;
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		public bool GetHSLocationIncludeElevation(ref double dHSAngle, ref XYZ ptHSPosition, Element selHS)
		{
			ptHSPosition = null;
			dHSAngle = 0.0;
			Location location = selHS.Location;
			LocationPoint locationPoint = location as LocationPoint;
			bool flag = locationPoint != null;
			bool result;
			if (flag)
			{
				ptHSPosition = locationPoint.Point;
				dHSAngle = locationPoint.Rotation;
				result = true;
			}
			else
			{
				result = false;
			}
			return result;
		}

		public bool CopyByPipe(bool bSelPipe = true)
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			Element element = pipeSelect.SelectSingleHS("请选择复制的支吊架");
			bool flag = element == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				XYZ xyz = null;
				double num = 0.0;
				this.GetHSLocation(ref num, ref xyz, element);
				XYZ xyz2 = Utils.Vector(num - Math.PI*.5);
				double hselementWide = PipeSelect.GetHSElementWide(element);
				FamilySymbol symbol = ((FamilyInstance)element).Symbol;
				HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
				this.SetGetHSFamilyInstanceParValue(element, ref this.m_HSTypeManage.m_hsTypeDefault, false);
				double num2 = this.m_HSTypeManage.m_hsTypeDefault.GetWideForVerLink();
				HSType eType = this.m_HSTypeManage.m_hsTypeDefault.m_eType;
				this.m_HSTypeManage.m_hsTypeDefault = hsTypeDefault;
				HSManage hsmanage = new HSManage(this.m_uiApp);
				DlgHSDistLayCopy dlgHSDistLayCopy = new DlgHSDistLayCopy(HSDraw.m_dDistStart, HSDraw.m_dDistSeparation);
				dlgHSDistLayCopy.Show(HSManage._hWndRevit);
				int wMsg = 7;
				HSDraw.SendMessage(HSManage._hWndRevit.Handle, wMsg, IntPtr.Zero, IntPtr.Zero);
				double num3 = 0.0;
				for (;;)
				{
					XYZ xyz3 = null;
					Line line2;
					if (bSelPipe)
					{
						Element element2 = pipeSelect.SelectSinglePipe(ref xyz3, "请选择布置支吊架的风管、管道、桥架、线管等", true);
						bool flag2 = element2 == null;
						if (flag2)
						{
							break;
						}
						bool flag3 = !Utils.IsHorizontalPipe(element2);
						if (flag3)
						{
							goto Block_4;
						}
						Element element3 = pipeSelect.SelectSinglePipe(ref xyz3, "请选择第二条平行管线，或取消选择,按第一条管线进行布置", true);
						bool flag4 = element3 == null;
						Line line;
						if (flag4)
						{
							MEPCurve mepcurve = element2 as MEPCurve;
							bool flag5 = mepcurve == null;
							if (flag5)
							{
								continue;
							}
							LocationCurve locationCurve = mepcurve.Location as LocationCurve;
							line = (locationCurve.Curve as Line);
						}
						else
						{
							bool flag6 = !Utils.Is2PipeParallel(element2, element3);
							if (flag6)
							{
								goto Block_7;
							}
							pipeSelect.m_listElementSel.Clear();
							pipeSelect.m_listElementSel.Add(element2);
							pipeSelect.m_listElementSel.Add(element3);
							pipeSelect.GetSecInfoFromSelPipes();
							MEPCurve mepcurve2 = pipeSelect.m_listElementSel[0] as MEPCurve;
							bool flag7 = mepcurve2 == null;
							if (flag7)
							{
								continue;
							}
							MEPCurve mepcurve3 = pipeSelect.m_listElementSel[1] as MEPCurve;
							bool flag8 = mepcurve3 == null;
							if (flag8)
							{
								continue;
							}
							LocationCurve locationCurve2 = mepcurve2.Location as LocationCurve;
							LocationCurve locationCurve3 = mepcurve3.Location as LocationCurve;
							line = (locationCurve2.Curve as Line);
							XYZ xyz4 = line.GetEndPoint(0);
							XYZ xyz5 = line.GetEndPoint(1);
							XYZ xyz6 = Utils.getCloestPointOnCurve(xyz4, locationCurve3.Curve, true);
							XYZ pt = Utils.getCloestPointOnCurve(xyz5, locationCurve3.Curve, true);
							xyz4 = Utils.PtTo2d(xyz4);
							xyz5 = Utils.PtTo2d(xyz5);
							xyz6 = Utils.PtTo2d(xyz6);
							pt = Utils.PtTo2d(pt);
							XYZ xyz7 = (xyz6 - xyz4).Normalize();
							double num4 = Utils.mmToFeet(pipeSelect.m_listSecSel[0].m_dWide / 2.0);
							double num5 = Utils.mmToFeet(pipeSelect.m_listSecSel[1].m_dWide / 2.0);
							XYZ xyz8 = -xyz7 * num4 + xyz7 * (num4 + num5 + xyz4.DistanceTo(xyz6)) / 2.0;
							XYZ xyz9 = xyz4 + xyz8;
							XYZ xyz10 = xyz5 + xyz8;
							line = Line.CreateBound(xyz9, xyz10);
						}
						line2 = Line.CreateBound(Utils.PtTo2d(line.GetEndPoint(0)), Utils.PtTo2d(line.GetEndPoint(1)));
						PipeSectionDef pipeSectionSize = PipeSelect.GetPipeSectionSize(element2, this.m_doc);
						num3 = pipeSectionSize.m_dWide;
					}
					else
					{
						XYZ xyz11 = XYZ.Zero;
						XYZ xyz12 = XYZ.Zero;
						try
						{
							xyz11 = Utils.PtTo2d(this.m_selection.PickPoint("请选择布置支吊架中心线起点"));
							xyz12 = Utils.PtTo2d(this.m_selection.PickPoint("请选择布置支吊架中心线终点"));
						}
						catch (Exception)
						{
							dlgHSDistLayCopy.Close();
							return false;
						}
						bool flag9 = xyz11.DistanceTo(xyz12) < 1.0;
						if (flag9)
						{
							Utils.MessageBox("长度太短");
							continue;
						}
						xyz11 = Utils.SetPtZ(xyz11, xyz.Z);
						xyz12 = Utils.SetPtZ(xyz12, xyz.Z);
						line2 = Line.CreateBound(xyz11, xyz12);
					}
					bool flag10 = eType == HSType.kDJ_DB;
					if (flag10)
					{
						num2 *= 3.0;
						num2 += num3;
					}
					HSDraw.m_dDistStart = dlgHSDistLayCopy.GetDistStart();
					double dDistStart = HSDraw.m_dDistStart;
					HSDraw.m_dDistSeparation = dlgHSDistLayCopy.GetDistSeparation();
					bool flag11 = false;
					bool flag12 = xyz2.IsAlmostEqualTo(line2.Direction) || xyz2.IsAlmostEqualTo(-line2.Direction);
					if (flag12)
					{
						Line line3 = Line.CreateUnbound(line2.GetEndPoint(0), line2.Direction);
						XYZ xyzpoint = line3.Project(xyz).XYZPoint;
						XYZ xyzpoint2 = line2.Project(xyz).XYZPoint;
						bool flag13 = xyzpoint.IsAlmostEqualTo(xyzpoint2) && xyzpoint.DistanceTo(Utils.PtTo2d(xyz)) < HSFamily.mmToFeet(num2 / 2.0);
						if (flag13)
						{
							XYZ endPoint = line2.GetEndPoint(0);
							XYZ endPoint2 = line2.GetEndPoint(1);
							double num6 = HSFamily.feetToMM(xyzpoint.DistanceTo(line2.GetEndPoint(0)));
							double num7 = HSFamily.feetToMM(xyzpoint.DistanceTo(line2.GetEndPoint(1)));
							dDistStart = num6 + HSDraw.m_dDistSeparation;
							bool flag14 = num6 > num7;
							if (flag14)
							{
								dDistStart = num7 + HSDraw.m_dDistSeparation;
								line2 = Line.CreateBound(line2.GetEndPoint(1), line2.GetEndPoint(0));
							}
							bool flag15 = xyz3 != null;
							if (flag15)
							{
								xyz3 = line3.Project(xyz3).XYZPoint;
								bool flag16 = endPoint.DistanceTo(xyz3) > endPoint.DistanceTo(xyzpoint2);
								if (flag16)
								{
									dDistStart = num6 + HSDraw.m_dDistSeparation;
									line2 = Line.CreateBound(endPoint, endPoint2);
								}
								else
								{
									dDistStart = num7 + HSDraw.m_dDistSeparation;
									line2 = Line.CreateBound(endPoint2, endPoint);
								}
							}
							XYZ xyz13 = xyz - xyzpoint;
							line2 = Line.CreateBound(line2.GetEndPoint(0) + xyz13, line2.GetEndPoint(1) + xyz13);
							flag11 = true;
						}
					}
					List<XYZ> list = new List<XYZ>();
					List<double> list2 = new List<double>();
					this.GetDistSeparationPts(ref list, ref list2, line2, dDistStart, HSDraw.m_dDistSeparation, false);
					Transaction transaction = new Transaction(this.m_doc, "CreateHS");
					transaction.Start();
					for (int i = 0; i < list.Count; i++)
					{
						XYZ ptBase = list[i];
						double dAngle = list2[i];
						bool flag17 = flag11;
						if (flag17)
						{
							dAngle = num;
						}
						this.NewHS(ptBase, dAngle, element);
					}
					transaction.Commit();
				}
				dlgHSDistLayCopy.Close();
				return false;
				Block_4:
				Utils.MessageBox("请选择水平的");
				dlgHSDistLayCopy.Close();
				return false;
				Block_7:
				Utils.MessageBox("两个管道不平行");
				dlgHSDistLayCopy.Close();
				result = false;
			}
			return result;
		}

		public bool CopyByCurve()
		{
			CmdViewType types = (CmdViewType)17;
			bool flag = SwitchView.SetUsableView(types, this.m_uiApp) > 0;
			return !flag && this.CopyByPipe(false);
		}

		public bool GetDefineFromDrawSelect(ref HSDefineInfo def)
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			Element element = pipeSelect.SelectSingleHS("请选择支吊架");
			bool flag = element == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				this.SetGetHSFamilyInstanceParValue(element, ref def, false);
				result = true;
			}
			return result;
		}

		public HSDefineInfo GetElementHSDefine(Element elem)
		{
			HSDefineInfo result = new HSDefineInfo();
			this.SetGetHSFamilyInstanceParValue(elem, ref result, false);
			return result;
		}

		public bool DeleteSelect()
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			List<Element> list = pipeSelect.SelectMultiHS("请选择要删除的支吊架");
			Transaction transaction = new Transaction(this.m_doc);
			transaction.Start("tranDel");
			foreach (Element elem in list)
			{
				this.m_doc.DeleteElement(elem);
			}
			transaction.Commit();
			return true;
		}

		public string GetElementFamilyName(Element ele)
		{
			return ((FamilyInstance)ele).Symbol.Family.Name;
		}

		public bool SetHSElementDefine(ref Element eleHS, HSDefineInfo hsDef)
		{
			string elementFamilyName = this.GetElementFamilyName(eleHS);
			HSFamily hsfamily = new HSFamily(this.m_uiApp);
			string hsfamilyName = hsfamily.GetHSFamilyName(hsDef);
			bool flag = elementFamilyName == hsfamilyName;
			bool result;
			if (flag)
			{
				Transaction transaction = new Transaction(this.m_doc);
				transaction.Start("tran");
				bool flag2 = this.SetGetHSFamilyInstanceParValue(eleHS, ref hsDef, true);
				transaction.Commit();
				result = flag2;
			}
			else
			{
				bool flag3 = !hsfamily.CreateHSFamily(hsDef, false, true, true);
				if (flag3)
				{
					result = false;
				}
				else
				{
					FamilySymbol hssymbol = this.GetHSSymbol(hsDef);
					XYZ ptBase = null;
					double dAngle = 0.0;
					this.GetHSLocation(ref dAngle, ref ptBase, eleHS);
					Transaction transaction2 = new Transaction(this.m_doc, "CreateHS");
					transaction2.Start();
					FamilyInstance familyInstance = this.NewHS(ptBase, dAngle, hssymbol, ref hsDef, null);
					this.m_doc.DeleteElement(eleHS);
					eleHS = familyInstance;
					transaction2.Commit();
					result = true;
				}
			}
			return result;
		}

		public bool FormatCopy()
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			Element element = pipeSelect.SelectSingleHS("请选择原始支吊架");
			bool flag = element == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				HSDefineInfo hsdefineInfo = new HSDefineInfo();
				this.SetGetHSFamilyInstanceParValue(element, ref hsdefineInfo, false);
				List<Element> list = pipeSelect.SelectMultiHS("请选择要更新信息的支吊架");
				Transaction transaction = new Transaction(this.m_doc);
				transaction.Start("tran");
				foreach (Element element2 in list)
				{
					bool flag2 = element.Id == element2.Id;
					if (!flag2)
					{
						double dAngle = 0.0;
						XYZ zero = XYZ.Zero;
						this.GetHSLocation(ref dAngle, ref zero, element2);
						this.NewHS(zero, dAngle, element);
						this.m_doc.DeleteElement(element2);
					}
				}
				transaction.Commit();
				result = true;
			}
			return result;
		}

		public bool ApplyDefineToSelect()
		{
			PipeSelect pipeSelect = new PipeSelect(this.m_uiApp);
			List<Element> list = pipeSelect.SelectMultiHS("请选择要更新信息的支吊架");
			bool flag = list.Count == 0;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				HSDefineInfo hsTypeDefault = this.m_HSTypeManage.m_hsTypeDefault;
				foreach (Element element in list)
				{
					Element element2 = element;
					this.SetHSElementDefine(ref element2, hsTypeDefault);
				}
				result = true;
			}
			return result;
		}

		private UIApplication m_uiApp;

		private Document m_doc;

		private Selection m_selection;

		private HSTypeInfo m_HSTypeManage;

		public static double m_dDistStart = 100.0;

		public static double m_dDistSeparation = 3000.0;

		public static bool isAuto = true;

		private List<DuctHSInfo> GJList = new List<DuctHSInfo>
		{
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L36X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L36X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L40X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L40X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L560X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L40X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L40X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L40X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L56X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L70X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C10"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 2500.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C10"
			}
		};

		private List<DuctHSInfo> XBList = new List<DuctHSInfo>
		{
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L50X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L50X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L50X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = false,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L50X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L50X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L50X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L56X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "L63X5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L63X5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L63X5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C5"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 2.0,
				isMaterial = true,
				format = "C6.3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "C8"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.5,
				isMaterial = true,
				format = "C8"
			}
		};

		private List<DuctHSInfo> SJList = new List<DuctHSInfo>
		{
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.5,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L25X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.6,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 0.75,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.0,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 400.0,
				bMin = 0.0,
				thinckness = 1.2,
				isMaterial = false,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 1250.0,
				bMin = 400.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2000.0,
				bMin = 1250.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.5,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 400.0,
				aMin = 0.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L30X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.6,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 1250.0,
				aMin = 400.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L45X3"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 0.75,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.0,
				isMaterial = true,
				format = "L63X4"
			},
			new DuctHSInfo
			{
				aMax = 2000.0,
				aMin = 1250.0,
				bMax = 2500.0,
				bMin = 2000.0,
				thinckness = 1.2,
				isMaterial = true,
				format = "L63X4"
			}
		};

		private List<DuctFormatInfo> FormatList = new List<DuctFormatInfo>
		{
			new DuctFormatInfo
			{
				name = "C5",
				h = 50.0,
				b = 37.0,
				t = 7.0
			},
			new DuctFormatInfo
			{
				name = "C6.3",
				h = 63.0,
				b = 40.0,
				t = 7.5
			},
			new DuctFormatInfo
			{
				name = "C8",
				h = 80.0,
				b = 43.0,
				t = 8.0
			},
			new DuctFormatInfo
			{
				name = "C10",
				h = 100.0,
				b = 48.0,
				t = 8.5
			},
			new DuctFormatInfo
			{
				name = "C12.6",
				h = 126.0,
				b = 53.0,
				t = 9.0
			}
		};

		private bool isTran = true;
	}
}
